Closed ignaciosiri closed 6 years ago
thanks for reporting an issue :) a fix is coming soon, already in master. waiting for specs
Excellent, thanks!
try rails_db-2.0.1.gem
Figured out I can't try newers versions because im running rails 4.1.8 in this project 😠I'll try next with new ones :) Thanks, super fast fix!!
I see ... okay then I suggest to make a fork and do this change in your fork:
and use it
I don't plan to add support for paranoia for older rails, at least not now, maybe you can add support for it and make a PR from your fork
Ok, i'll give it a try! Thanks for ur time and support!
Hi @igorkasyanchuk, I've made the changes you mentioned (locally in the gem's file) and it works like a charm. I'm not very familiar with forks/PRs/etc specially to target an older version of the gem. If you want me to do something to merge the code im here to help, but need some guidelines haha.
Here's the final _edit.html.erb code:
<a class="close-reveal-modal" aria-label="Close">×</a>
<h2 id="modalTitle">Edit</h2>
<%= simple_form_for @record, as: 'record', url: table_update_path(@table, pk_id: @record[@table.primary_key]), remote: true, method: :put, html: {class: 'vertical_form'} do |form| %>
<div class='scrollable_form'>
<% @record.class.columns.each do |column| %>
<% name = column.name %>
<% next if name == @table.primary_key %>
<% options = { label: name } %>
<% options[:include_blank] = true if column.type.to_s =~ /time|date/ %>
<% if column.type.to_s =~ /text/ %>
<% options[:input_html] = {} %>
<% options[:input_html][:rows] = 4 %>
<% options[:input_html][:cols] = 80 %>
<% end %>
<%= form.input name, options %>
<% end %>
</div>
<%= form.submit 'SAVE', class: 'button small' %>
<a class='close' onclick="$('#system_modal').foundation('reveal', 'close');$">Close</a>
<% end %>
<span class="radius warning label">NOTE: Update will happen without any validations.</span>
push your code to github and create a PR for rails_4_x branch. https://help.github.com/articles/creating-a-pull-request/
Perfect! I've just created the PR, hope it helped! Have a great day! :)
Hi! Love this gem, but i'm using paranoia to handle soft deletes, so when i try to edit a record, even if i don't set a date for deleted_at field, it comes preset on the edit form, making the record "deleted" to the app.
Am I misunderstanding something?
It would be nice to handle nil dates, so it preserves the value. Maybe a datepicker instead of rails's input date fields?
Hope to hear your thoughts about this and discuss possible solutions!
Cheers!