From fd9ca8d2fc04fc062e5529cb9e86c449c6c2a770 Mon Sep 17 00:00:00 2001 From: albert Date: Fri, 22 Mar 2013 09:58:31 -0700 Subject: [PATCH] fixes #987 --- app/controllers/favorites_controller.rb | 2 +- app/controllers/notes_controller.rb | 2 +- app/logical/post_sets/favorite.rb | 4 ++-- app/logical/post_sets/note.rb | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/favorites_controller.rb b/app/controllers/favorites_controller.rb index 7a0e7bd6d..c90c8e5fe 100644 --- a/app/controllers/favorites_controller.rb +++ b/app/controllers/favorites_controller.rb @@ -5,7 +5,7 @@ class FavoritesController < ApplicationController if params[:tags] redirect_to(posts_path(:tags => params[:tags])) else - @favorite_set = PostSets::Favorite.new(CurrentUser.user, params[:page]) + @favorite_set = PostSets::Favorite.new(CurrentUser.user, params[:page], params) end end diff --git a/app/controllers/notes_controller.rb b/app/controllers/notes_controller.rb index 78a597e24..ffedd5db4 100644 --- a/app/controllers/notes_controller.rb +++ b/app/controllers/notes_controller.rb @@ -63,7 +63,7 @@ private end def index_by_note - @notes = Note.search(params[:search]).order("id desc").paginate(params[:page], :search_count => params[:search]) + @notes = Note.search(params[:search]).order("id desc").paginate(params[:page], :limit => params[:limit], :search_count => params[:search]) respond_with(@notes) do |format| format.html {render :action => "index_by_note"} end diff --git a/app/logical/post_sets/favorite.rb b/app/logical/post_sets/favorite.rb index f932a4977..404ade35a 100644 --- a/app/logical/post_sets/favorite.rb +++ b/app/logical/post_sets/favorite.rb @@ -2,9 +2,9 @@ module PostSets class Favorite < Base attr_reader :user, :page, :favorites - def initialize(user_id, page = 1) + def initialize(user_id, page = 1, params = {}) @user = ::User.find(user_id) - @favorites = ::Favorite.for_user(user.id).paginate(page).order("favorites.id desc") + @favorites = ::Favorite.for_user(user.id).paginate(page, :limit => params[:limit]).order("favorites.id desc") end def tag_array diff --git a/app/logical/post_sets/note.rb b/app/logical/post_sets/note.rb index fbaca8191..ce84c1626 100644 --- a/app/logical/post_sets/note.rb +++ b/app/logical/post_sets/note.rb @@ -4,7 +4,7 @@ module PostSets # don't call super because we don't want to repeat these queries @tag_array = Tag.scan_query(params[:tags]) @page = params[:page] || 1 - @posts = ::Post.tag_match(tag_string).has_notes.paginate(page).reorder("last_noted_at desc") + @posts = ::Post.tag_match(tag_string).has_notes.paginate(page, :limit => params[:limit]).reorder("last_noted_at desc") end end end