Last active
December 12, 2015 09:39
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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