Local variable not being passed to partial template by render?
Posted
by brad
on Stack Overflow
See other posts from Stack Overflow
or by brad
Published on 2010-04-17T14:08:17Z
Indexed on
2010/04/17
14:13 UTC
Read the original article
Hit count: 187
I don't seem to be able to pass a variable to my partial template in rails (2.3.5). My code is as follows;
In the main view .html.erb file:
<% f.fields_for :payments do |payment_form| %>
<%= render 'payment', {:f => payment_form, :t => "test" } %>
<% end %>
and in the _payment.html.erb file:
<%= t %>
produces a wrong number of arguments (0 for 1)
error. The payment_form object is being passed to the partial as f without any problems. I've tried a number of variations on the above syntax (e.g. :locals => {:f => payment_form, :t => "test" }
without success. I presume I'm doing something pretty basic wrong but just can't see it.
© Stack Overflow or respective owner