From 7d4a81560d1408b372bdfec303584e66494c3d57 Mon Sep 17 00:00:00 2001 From: Sarah Mei Date: Fri, 27 Jan 2012 21:56:27 -0800 Subject: [PATCH] Move contact pagination to controller - fixes #2760 --- app/controllers/contacts_controller.rb | 2 +- app/models/contact.rb | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/controllers/contacts_controller.rb b/app/controllers/contacts_controller.rb index d42a8288d..403b5f2e5 100644 --- a/app/controllers/contacts_controller.rb +++ b/app/controllers/contacts_controller.rb @@ -19,7 +19,7 @@ class ContactsController < ApplicationController current_user.contacts.receiving end end - @contacts = @contacts.for_a_stream(params[:page]) + @contacts = @contacts.for_a_stream.paginate(:page => params[:page], :per_page => 25) respond_to do |format| format.json { diff --git a/app/models/contact.rb b/app/models/contact.rb index cd2f5f243..cf5e66be5 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -37,10 +37,9 @@ class Contact < ActiveRecord::Base where(:receiving => true) } - scope :for_a_stream, lambda { |page| + scope :for_a_stream, lambda { includes(:aspects, :person => :profile). - order('profiles.last_name ASC'). - paginate(:page => page, :per_page => 25) + order('profiles.last_name ASC') } scope :only_sharing, lambda {