I’m trying to pass the id of an object in a hidden field in a complex
form and I while I’ve googled a bunch on this I can’t seem to figure out
the problem
My form looks like this:
<% fields_for “recipe[ingredient_attributes][]”, ingredient do |
ingredient_form |%>
<% if ingredient.new_record? %> <%= link_to_function 'remove', "this.up('.ingredient').remove()" %> <% else %>
<!-- this is the field that keeps failing -->
<%= ingredient_form.hidden_field :id %>
<!-- everything works fine if this is a text_field -->
<%= link_to_function 'remove', "mark_for_destroy(this,
‘ingredient’)" %>
<% end %>
and I keep getting this error:
wrong number of arguments (3 for 2)
how is:
<%= ingredient_form.hidden_field :id %>
three arguments?
If I remove the :id it says I have no arguments, and as far as I can
tell there’s nothing special in :id. I get the same error if I use a
param name that isn’t used anywhere else in my code.