In my template, I call this partial with an additional parameter:
<table>
<%= render :partial => "shared/finder_list_header.html.erb",
:locals =>
{ :selectFinder => true } %>
...
</table>
Inside the partial I try to access selectFinder:
<% if selectFinder %>
<th></th>
<% end %>
and get an error message:
undefined local variable or method `selectFinder'' for
#<ActionView::Base:0xb6ef1f58>
What is going wrong?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Fritz Trapper wrote:> In my template, I call this partial with an additional parameter: > > <table> > <%= render :partial => "shared/finder_list_header.html.erb", :locals => > { :selectFinder => true } %> > ... > </table> > > Inside the partial I try to access selectFinder: > > <% if selectFinder %> > <th></th> > <% end %> > > and get an error message: > > undefined local variable or method `selectFinder'' for > #<ActionView::Base:0xb6ef1f58> > > What is going wrong?Hum. It looks like you''re basically do it right. I do this quite a bit in my partials. The only thing I see is that you''re not following Ruby conventions. Ruby does not use camel case for variable/symbols. It should be :select_finder and select_finder instead of using camel case. I also don''t normally use them for passing in constant values as in { :select_finder => true }. So I threw together a quick test program and everything seems to be working as expected. <%= render :partial => ''parts'', :locals => { :select_finder => true } In the partial... <% if select_finder %> .... .... <% end %> -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks for your reply. Changeing selectFinder to select_finder doesn''t help. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
It was my fault, sorry. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.