Render partial :collection => @array specify variable name

Found this is also helpful from the docs. You aren’t limited to having the variable named after the partial:

http://guides.rubyonrails.org/layouts_and_rendering.html

To use a custom local variable name within the partial, specify the
:as option in the call to the partial:

<%= render :partial => "product", :collection => @products, :as => :item %>

With this change, you can access an instance of the @products collection as the item local variable within the partial.”

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)