Maybe I'm misunderstanding something but it appears as if
<%= render :partial => @items, @locals => { :this => 'that' } %>
does not give the local variable this but this one does:
<%= render :partial => 'items/item', :collection => @items, @locals => {
:this => 'that' } %>
Shouldn't they mean the same thing?
I'm running rails 2.0.2
Maybe I'm misunderstanding something but it appears as if
<%= render :partial => @items, @locals => { :this => 'that' } %>
does not give the local variable this but this one does:
<%= render :partial => 'items/item', :collection => @items, @locals
=> {
:this => 'that' } %>
Maybe I'm misunderstanding something but it appears as if
<%= render :partial => @items, @locals => { :this => 'that' } %>
does not give the local variable this but this one does:
<%= render :partial => 'items/item', :collection => @items, @locals
=> {
:this => 'that' } %>
So, if you pass an array or an association collection (such as @items
above) as the value of the :partial key, then local_assigns is *not*
passed through. Unless I'm reading this all wrong.
I have not looked to see if this is expected behaviour or a bug...
So yes, things work differently for partials if a collection is
supplied. Note that options[:locals] is supplied to #render_partial but
the argument in my previous post shows why this is not passed through to
#render_partial_collection, but it is if options[:collection] is
defined.