On Jul 27, 2007, at 5:37 AM, Martin DeMello wrote:
> How do you access something you''ve passed to a partial in the
> locals hash?
>
> <% for file in @file_list %>
> <tr id="file_row_<%= file[0].id %>">
> <%= render_no_layout :template => "/shared/_file",
> :locals => { :file => file } %>
> </tr>
> <% end %>
>
> but when rendering the shared/_file.rhtml template it complains about
> missing local variable or
> method ''file''
>
> martin
Hi Martin-
Use the partial() method to render partials or render :partial =>
> <% for file in @file_list %>
> <tr id="file_row_<%= file[0].id %>">
> <%= render :partial => "/shared/file",
> :locals => { :file => file } %>
> </tr>
> <% end %>
Cheers-
-- Ezra Zygmuntowicz
-- Founder & Ruby Hacker
-- ez at engineyard.com
-- Engine Yard, Serious Rails Hosting
-- (866) 518-YARD (9273)