Commit 0f6013d5
Changed files (3)
app
app/controllers/profiles_controller.rb
@@ -2,7 +2,7 @@ class ProfilesController < ApplicationController
before_filter :authenticate_user!, :except => [:index, :show]
def index
- @profiles = User.all.reverse
+ @profiles = User.page(params[:page]).per(12)
end
def show
app/models/user.rb
@@ -10,6 +10,7 @@ class User < ActiveRecord::Base
has_and_belongs_to_many :interests, :join_table => 'users_interests', :uniq => true, :autosave => true
has_one :avatar
acts_as_tagger
+ default_scope order("created_at DESC")
def add_favorite( creation )
if self.already_likes(creation)
app/views/profiles/index.html.erb
@@ -1,6 +1,6 @@
-<% provide(:title, pluralize(@profiles.length, "artist")) -%>
+<% provide(:title, "Cake Artists") -%>
<% content_for :page_header do -%>
- <h1><%= pluralize @profiles.count, "artist" %></h1>
+ <h1>Cake Artists</h1>
<% end -%>
<div class="row">
<div class="span12">
@@ -23,3 +23,6 @@
</ul>
</div>
</div>
+<div class="row">
+ <div class="span12"> <%= paginate @profiles %> </div>
+</div>