Why not use :locals => ?
On Feb 24, 11:13 am, MaggotChild <[email protected]> wrote:
> I'm trying to render a collection of partials using :as. It raises an
> undefined local variable exception. Not sure why:
>
> ~/delivery-log/app/views/packages $ ls -1
> _package.html.erb
> _package_list.html.erb
> index.html.erb
>
> index.html.erb:
> <%=
> render :partial=>'package_list', :collection=>@packages, :as=>:package
> %>
>
> _package_list.html.erb:
> <tr>
> <td><%= package.upc %></td>
> </tr>
>
> Seems simple, but it only raises the aforementioned exception:
>
> ActionView::TemplateError (undefined local variable or method
> `package' for #<ActionView::Base:0xb7589ac8>) on line #2 of packages/
> _package_list.html.erb:
> 1: <tr>
> 2: <td><%= package.upc %></td>
> 3: </tr>
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---