This should be straightforward but a search hasn''t helped: I want to convert this: <% for post in @posts %> <div class=''PostBlock''> <div class=''PostTitle''><%= link_to "#{post.title}" %></div> <div class=''PostAuthor''>posted by <%= link_to "#{post.person.name}" %></div> <br /> <div class=''PostBody''><%= h(post.body) %></div> </div> <br /> <% end %> into THIS: <% for post in @posts %> <%= render :partial => ''postblock''% <% end %> but just moving the PostBlock div into _postblock.rhtml gives an invalid action for "post." How can I cleanly separate this? I''ve also tried using :collection => @posts but the documentation on :collection is very poor. Thanks! -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
It was a naming convention problem. Since the passed object is automagically named the same thing as the partial, penaming the partial to "_post.rhtml" works: <%= render :partial => ''post'', :collection => @posts %> This information came from page 511 in AWDwRv2 -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---