diff options
author | Andrew Hooker <GeekOnCoffee@gmail.com> | 2012-05-19 20:00:16 -0500 |
---|---|---|
committer | Andrew Hooker <GeekOnCoffee@gmail.com> | 2012-05-19 20:00:16 -0500 |
commit | 86fa2d2f5d0c2bfb9900bb795bfafe78d09c897d (patch) | |
tree | 89aa1c39fcdc2aa5e9d2255d418aa42021abab34 /app | |
parent | 6fa5bbdf33b681f7c9595a327a39cc99de7bf638 (diff) | |
download | refinerycms-blog-86fa2d2f5d0c2bfb9900bb795bfafe78d09c897d.tar.gz refinerycms-blog-86fa2d2f5d0c2bfb9900bb795bfafe78d09c897d.tar.bz2 refinerycms-blog-86fa2d2f5d0c2bfb9900bb795bfafe78d09c897d.zip |
Renaming Method to better describe use, Including Deprecation Warning on Old Method
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 b078272..3e3d85c 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) + warn "[Deprecation Warning] Refinery::Blog::Post.by_archive(date) has been replaced with by_month" + by_month(date) + end + def by_year(date) where(:published_at => date.beginning_of_year..date.end_of_year) end |