> in the view (app/views/people/index.html.erb):
> 
> <% content_for :title do -%>
>   <h3>Listing People</h3>
> <% end -%>
> 
> <table>
>   <tr>
>     <th>First Name</th>
>     <th>Last Name</th>
>   </tr>
>   <%= render :partial => "people", :collection => @people %>
> </table>

> in the partial (app/views/people/_people.html.erb):
> 
> <tr class=<%= cycle("odd","even")%>>
>   <td><%= h person.first_name %></td>
>   <td><%= h person.last_name %></td>
> </tr>
> 
> ----
> 
> I made sure I had data available for these people (using 
> script/console), but I got an error rendering this partial:
> 
> undefined local variable or method 'person' for #<ActionView::....>
> 
> in app/views/people/_people.html.erb
> 

OK, I figured out my mistake - when creating the partial, I called it
"_people.html.erb" instead of "_person.html.erb", so the rails engine
probably didn't know what to look for. Also needed to change the call to
render from <%= render :partial => "people" ....%>  to <%= render
:partial => "person"...%>

I would like to know how to override this behavior so that I could call
the partial and the collections however I want. Thanks to everyone who
helped on this post!
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to