Hidden fields on complex forms

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 %>

<% 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.

On Aug 4, 11:47 pm, Skye Weir-Mathews <rails-mailing-l…@andreas-
s.net> wrote:

how is:

<%= ingredient_form.hidden_field :id %>

three arguments?

Because that function is calling some other function and it’s that
function that is calling some function with the wrong number of
arguments (look at the stack trace).
Typically this is because some plugin is overriding an internal rails
function and the signature of that function has changed since the
plugin was written.

Fred