Skip to content

Commit

Permalink
generate hidden inputs manually to keep markup consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
igorbernstein committed Nov 10, 2013
1 parent 41ab134 commit 9aca4ae
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/active_admin/form_builder.rb
Expand Up @@ -68,6 +68,15 @@ def has_many(assoc, options = {}, &block)
has_many_form.input :_destroy, as: :boolean, wrapper_html: {class: 'has_many_delete'},
label: I18n.t('active_admin.has_many_delete')
end

# generate a hidden input field to keep the mark up consistent
# to disable this, pass for_options: { include_id: false}
# NOTE: has_many_form is a different instance then the one defining this block...has_many_form.object_id != self.object_id
puts "#{has_many_form.class.name} #{has_many_form.object_id} ??? #{self} #{self.object_id}"
if has_many_form.object.persisted? && has_many_form.options.fetch(:include_id, true) && !has_many_form.emitted_hidden_id?
has_many_form.input :id, as: :hidden
end

contents
end

Expand Down

0 comments on commit 9aca4ae

Please sign in to comment.