hi all
this works
<%= render :partial => "admin/works/work", :collection =>
@artist.works %>
but this doesn''t
<%= render :partial => "admin/works/worklist", :collection
=>
@artist.works %>
even though the partial _work.rhtml and _worklist.rhtml are identical.
worklist.rhtml throws
undefined local variable or method `work''
Extracted source (around line #2):
1: <tr>
2: <td><%= link_to work.short_title, :action =>
''edit'', :id =>
work %></td>
any ideas why?
TIA DLG
--
Posted via http://www.ruby-forum.com/.
On 4/30/06, Damian leGassick <damianlegassick@mac.com> wrote:> hi all > > this works > > <%= render :partial => "admin/works/work", :collection => > @artist.works %> > > but this doesn''t > > <%= render :partial => "admin/works/worklist", :collection => > @artist.works %> > > > even though the partial _work.rhtml and _worklist.rhtml are identical. > > worklist.rhtml throws > > undefined local variable or method `work'' > Extracted source (around line #2): > > 1: <tr> > 2: <td><%= link_to work.short_title, :action => ''edit'', :id => > work %></td> > > any ideas why? > > TIA DLGThe local variable in the partial is named after the partial. Change it to: <%= link_to worklist.short_title, :action => ''edit'', :id => worklist %> jt
no worries, i figured it out but i''m still struggling with http://www.ruby-forum.com/topic/63930 if anyone''s feeling super-generous. cheers dlg -- Posted via http://www.ruby-forum.com/.
Partials generate parameter objects based on their names - you need:
1: <tr>
2: <td><%= link_to worklist.short_title, :action =>
''edit'', :id =>
worklist %></td>
Damian leGassick wrote:> hi all
>
> this works
>
> <%= render :partial => "admin/works/work", :collection
=>
> @artist.works %>
>
> but this doesn''t
>
> <%= render :partial => "admin/works/worklist",
:collection =>
> @artist.works %>
>
>
> even though the partial _work.rhtml and _worklist.rhtml are identical.
>
> worklist.rhtml throws
>
> undefined local variable or method `work''
> Extracted source (around line #2):
>
> 1: <tr>
> 2: <td><%= link_to work.short_title, :action =>
''edit'', :id =>
> work %></td>
>
> any ideas why?
>
> TIA DLG
--
Posted via http://www.ruby-forum.com/.