aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/refinery/blog/posts_controller.rb16
-rw-r--r--app/models/refinery/blog_post.rb3
2 files changed, 9 insertions, 10 deletions
diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb
index f055797..408359f 100644
--- a/app/controllers/refinery/blog/posts_controller.rb
+++ b/app/controllers/refinery/blog/posts_controller.rb
@@ -54,18 +54,16 @@ module Refinery
date = "#{params[:month]}/#{params[:year]}"
@archive_date = Time.parse(date)
@date_title = @archive_date.strftime('%B %Y')
- @blog_posts = BlogPost.live.by_archive(@archive_date).paginate({
- :page => params[:page],
- :per_page => Refinery::Setting.find_or_set(:blog_posts_per_page, 10)
- })
+ @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::live.by_year(@archive_date).paginate({
- :page => params[:page],
- :per_page => Refinery::Setting.find_or_set(:blog_posts_per_page, 10)
- })
+ @blog_posts = Refinery::BlogPost.live
+ .by_year(@archive_date)
+ .page(params[:page])
end
respond_with (@blog_posts)
end
@@ -75,7 +73,6 @@ module Refinery
@tag_name = @tag.name
@blog_posts = Refinery::BlogPost.tagged_with(@tag_name)
.page(params[:page])
- .per(Refinery::Setting.find_or_set(:blog_posts_per_page, 10))
end
protected
@@ -94,7 +91,6 @@ module Refinery
@blog_posts = Refinery::BlogPost.live
.includes(:comments, :categories)
.page(params[:page])
- .per(Refinery::Setting.find_or_set(:blog_posts_per_page, 10))
end
def find_tags
diff --git a/app/models/refinery/blog_post.rb b/app/models/refinery/blog_post.rb
index 12ce6f2..5eb2a6f 100644
--- a/app/models/refinery/blog_post.rb
+++ b/app/models/refinery/blog_post.rb
@@ -111,6 +111,9 @@ 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