All,
I am experiencing a problem with a standard fields_for setup. In my "_form" partial I have:
<div class="comment_list">
<%= f.fields_for :comments do |cf| %>
<%= render :partial => 'comments/comment_fields', :locals => {:f => cf, :tester => true} %>
<% end %>
<%= link_to_add_fields "Add a comment", f, :comments %>
</div>
In the "_comment_fields" partial, I have the usual fields and then my test variable:
<%= tester.to_s %>
When I remove the tester variable, everything works well. As soon as I add the test variable, I get this error:
ActionView::Template::Error (undefined local variable or method `tester' for #Class:0xa1f3664>:0xa1f1bd4>)
Has anyone else ran into this problem when using a fields_for with multiple locals?
To elaborate a bit more, my "_comment_fields" partial looks like this:
<div class="comment dynamic_field">
<span class="comment_content"><%= f.text_field :content, :class => "comment_content" %></span>
<%= tester.to_s %>
<%= link_to_remove_fields "remove", f %>
</div>
It is only called from the "_form" partial.