Skip to content

Instantly share code, notes, and snippets.

@voleinikov
Last active December 12, 2015 09:39
Show Gist options
  • Save voleinikov/4753090 to your computer and use it in GitHub Desktop.
Save voleinikov/4753090 to your computer and use it in GitHub Desktop.
Example of using a partial to render a collection of posts associated with a user
In views/users/show.html.erb
<ul>
<%= render @user.posts %>
</ul>
Meanwhile make views/posts/_post.html.erb and in that file have something like
<li> <%= post.body %> </li>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment