Add Topic#age_in_days for determining age of topic

This commit is contained in:
Chris Hunt 2013-05-27 17:58:57 -07:00
parent c32399a80b
commit 54a798eb12
1 changed files with 4 additions and 0 deletions

View File

@ -193,6 +193,10 @@ class Topic < ActiveRecord::Base
@post_numbers ||= posts.order(:post_number).pluck(:post_number)
end
def age_in_days
((Time.zone.now - created_at) / 1.day).round
end
def has_meta_data_boolean?(key)
meta_data_string(key) == 'true'
end