Skip to content

Instantly share code, notes, and snippets.

@davidrhoden
Created October 23, 2013 20:39
Show Gist options
  • Save davidrhoden/7126267 to your computer and use it in GitHub Desktop.
Save davidrhoden/7126267 to your computer and use it in GitHub Desktop.
where the partial is called:
<ul class="user_avatars">
<%= render :partial => 'users/user_avatar', collection: @users %>
<%= render @users %>
</ul>
_user_avatar.html.erb:
<li>
<%= image_tag @users.avatar.url(:thumb) %>
</li>
_user.html.erb:
<li>
<%= image_tag user.avatar.url(:thumb) %>
<%= link_to user.nice_name, user %>
<li>
Also, I have this in the pages controller, which controls the home page, where these are called:
def home
@title = "Home"
@users = User.order('created_at DESC').limit(9)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment