diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/refinery/blog/posts_controller.rb | 2 | ||||
-rw-r--r-- | app/models/refinery/blog/post.rb | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb index b453d72..caa46ec 100644 --- a/app/controllers/refinery/blog/posts_controller.rb +++ b/app/controllers/refinery/blog/posts_controller.rb @@ -60,7 +60,7 @@ module Refinery date = "#{params[:month]}/#{params[:year]}" @archive_date = Time.parse(date) @date_title = @archive_date.strftime('%B %Y') - @posts = Post.live.by_archive(@archive_date).page(params[:page]) + @posts = Post.live.by_month(@archive_date).page(params[:page]) else date = "01/#{params[:year]}" @archive_date = Time.parse(date) diff --git a/app/models/refinery/blog/post.rb b/app/models/refinery/blog/post.rb index 59e70f1..c32b775 100644 --- a/app/models/refinery/blog/post.rb +++ b/app/models/refinery/blog/post.rb @@ -53,10 +53,15 @@ module Refinery end class << self - def by_archive(date) + def by_month(date) where(:published_at => date.beginning_of_month..date.end_of_month) end - + + def by_archive(date) + Refinery.deprecate("Refinery::Blog::Post.by_archive(date)", {:replacement => "Refinery::Blog::Post.by_month(date)", :when => 2.2 }) + by_month(date) + end + def by_year(date) where(:published_at => date.beginning_of_year..date.end_of_year) end |