I am having an issue passing a :locals variable to two levels of views. Normally, I just use one and am just wondering if there is something that prevents this:
For example:
<%=render :partial => 'shared/following', :locals => {:following => @following} %>
in shared/_following.html.erb (assuming item is of type ‘Location’):
<% following.each do |item| %>
<% class_type=item.class.to_s %>
<%#works fine %>
<%=debug(item) %>
<%# a bunch of different types of things to follow %>
<%=render 'shared/box-'+class_type.downcase! , :locals => { :item => item } %>
<% end %>
in shared/_box-location.html.erb:
<% # this doesn't work nor does @item.name %>
<%=item.name %>
Can I do locals two levels deep? How can I / should I rectify?
thx
(Source)
:localsis also an additional option, so try this: