Renaming Method to better describe use, Including Deprecation Warning on Old Method
This commit is contained in:
parent
6fa5bbdf33
commit
86fa2d2f5d
3 changed files with 11 additions and 6 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue