From 9d23338de256b2f996810412457eb20e7f990b30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Thu, 28 Jul 2011 10:37:36 +0300 Subject: Array is paginated differently. --- app/controllers/refinery/admin/blog/posts_controller.rb | 6 +++--- app/models/refinery/blog_post.rb | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'app') diff --git a/app/controllers/refinery/admin/blog/posts_controller.rb b/app/controllers/refinery/admin/blog/posts_controller.rb index ee73ee2..e3b0f3b 100644 --- a/app/controllers/refinery/admin/blog/posts_controller.rb +++ b/app/controllers/refinery/admin/blog/posts_controller.rb @@ -9,9 +9,9 @@ module Refinery :order => 'published_at DESC' def uncategorized - @blog_posts = Refinery::BlogPost.page(params[:page]) - .uncategorized - + @blog_posts = Kaminari.paginate_array(Refinery::BlogPost.uncategorized) + .page(params[:page]) + .per(Refinery::BlogPost.per_page) end def tags diff --git a/app/models/refinery/blog_post.rb b/app/models/refinery/blog_post.rb index 5eb2a6f..f4bccf1 100644 --- a/app/models/refinery/blog_post.rb +++ b/app/models/refinery/blog_post.rb @@ -93,6 +93,11 @@ module Refinery def uncategorized BlogPost.live.reject { |p| p.categories.any? } end + + # how many items to show per page + def per_page + paginates_per Refinery::Setting.find_or_set(:blog_posts_per_page, 10) + end end module ShareThis @@ -111,9 +116,6 @@ module Refinery end end end - - # how many items to show per page - paginates_per Refinery::Setting.find_or_set(:blog_posts_per_page, 10) end end -- cgit v1.2.3