Rails 3.0 undefined local variable when rendering a partial -


i'm working rails 3.0.20 app , i'm trying pass local variable through partial , it's displaying 'undefined local variable' i've had @ other posts on issue , couldn't fix it.

here call render parital

    = f.fields_for :current_positions |builder|         = render :partial => 'current_position_fields', :locals => {:f => builder, :foo => 'hi'} 

here partial

%tr.pos_start     %td         = foo         = f.hidden_field :id, class: "pos_id"         = f.label :name, "position name"     %td= f.text_field :name %tr.pos_loc     %td= f.label :location, "position location"     %td= f.text_field :location %tr.pos_end     %td= f.label :year, "position year"     %td= f.text_field :year     %td.fields         = link_to_remove_fields "del", f 

the error message

undefined local variable or method `foo' #<#<class:0x00000008d4a050>:0x00000008d3c590> 

if take = foo out of code else works.

found error, calling partial in application helper , not passing on appropriate local variables.

i found when copy partial name , call variable , worked.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -