Skip to content
Browse files

+will_paginate

  • Loading branch information...
1 parent 7d11d9e commit 5129c6a843517ade3e71f2125e4fe62f043d2c70 @DarTSeNSe committed Dec 9, 2011
Showing with 15 additions and 7 deletions.
  1. +5 −0 app/controllers/users_controller.rb
  2. +4 −0 app/views/users/_user.html.erb
  3. +6 −7 app/views/users/index.html.erb
View
5 app/controllers/users_controller.rb
@@ -46,6 +46,11 @@ def update
end
end
+ def index
+ @title = "All users"
+ @users = User.paginate(:page => params[:page])
+ end
+
private
def authenticate
View
4 app/views/users/_user.html.erb
@@ -0,0 +1,4 @@
+<li>
+ <%= gravatar_for user, :size => 30 %>
+ <%= link_to user.name, user %>
+</li>
View
13 app/views/users/index.html.erb
@@ -1,10 +1,9 @@
<h1>All users</h1>
+<%= will_paginate %>
+
<ul class="users">
- <% @users.each do |user| %>
- <li>
- <%= gravatar_for user, :size => 30 %>
- <%= link_to user.name, user %>
- </li>
- <% end %>
-</ul>
+ <%= render @users %>
+</ul>
+
+<%= will_paginate %>

0 comments on commit 5129c6a

Please sign in to comment.
Something went wrong with that request. Please try again.