diff options
Diffstat (limited to 'app/controllers/refinery')
-rw-r--r-- | app/controllers/refinery/admin/blog/posts_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/refinery/blog/categories_controller.rb | 5 | ||||
-rw-r--r-- | app/controllers/refinery/blog/posts_controller.rb | 15 |
3 files changed, 6 insertions, 18 deletions
diff --git a/app/controllers/refinery/admin/blog/posts_controller.rb b/app/controllers/refinery/admin/blog/posts_controller.rb index e3b0f3b..c8c38b2 100644 --- a/app/controllers/refinery/admin/blog/posts_controller.rb +++ b/app/controllers/refinery/admin/blog/posts_controller.rb @@ -9,9 +9,7 @@ module Refinery :order => 'published_at DESC' def uncategorized - @blog_posts = Kaminari.paginate_array(Refinery::BlogPost.uncategorized) - .page(params[:page]) - .per(Refinery::BlogPost.per_page) + @blog_posts = Kaminari.paginate_array(Refinery::BlogPost.uncategorized).page(params[:page]).per(Refinery::BlogPost.per_page) end def tags diff --git a/app/controllers/refinery/blog/categories_controller.rb b/app/controllers/refinery/blog/categories_controller.rb index a363b8c..57196c3 100644 --- a/app/controllers/refinery/blog/categories_controller.rb +++ b/app/controllers/refinery/blog/categories_controller.rb @@ -4,10 +4,7 @@ module Refinery def show @category = Refinery::BlogCategory.find(params[:id]) - @blog_posts = @category.posts - .live - .includes(:comments, :categories) - .page(params[:page]) + @blog_posts = @category.posts.live.includes(:comments, :categories).page(params[:page]) end end diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb index 408359f..167aef3 100644 --- a/app/controllers/refinery/blog/posts_controller.rb +++ b/app/controllers/refinery/blog/posts_controller.rb @@ -54,16 +54,12 @@ module Refinery date = "#{params[:month]}/#{params[:year]}" @archive_date = Time.parse(date) @date_title = @archive_date.strftime('%B %Y') - @blog_posts = Refinery::BlogPost.live - .by_archive(@archive_date) - .page(params[:page]) + @blog_posts = Refinery::BlogPost.live.by_archive(@archive_date).page(params[:page]) else date = "01/#{params[:year]}" @archive_date = Time.parse(date) @date_title = @archive_date.strftime('%Y') - @blog_posts = Refinery::BlogPost.live - .by_year(@archive_date) - .page(params[:page]) + @blog_posts = Refinery::BlogPost.live.by_year(@archive_date).page(params[:page]) end respond_with (@blog_posts) end @@ -71,8 +67,7 @@ module Refinery def tagged @tag = ActsAsTaggableOn::Tag.find(params[:tag_id]) @tag_name = @tag.name - @blog_posts = Refinery::BlogPost.tagged_with(@tag_name) - .page(params[:page]) + @blog_posts = Refinery::BlogPost.tagged_with(@tag_name).page(params[:page]) end protected @@ -88,9 +83,7 @@ module Refinery end def find_all_blog_posts - @blog_posts = Refinery::BlogPost.live - .includes(:comments, :categories) - .page(params[:page]) + @blog_posts = Refinery::BlogPost.live.includes(:comments, :categories).page(params[:page]) end def find_tags |