Add Topic#age_in_days for determining age of topic
This commit is contained in:
parent
c32399a80b
commit
54a798eb12
|
@ -193,6 +193,10 @@ class Topic < ActiveRecord::Base
|
||||||
@post_numbers ||= posts.order(:post_number).pluck(:post_number)
|
@post_numbers ||= posts.order(:post_number).pluck(:post_number)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def age_in_days
|
||||||
|
((Time.zone.now - created_at) / 1.day).round
|
||||||
|
end
|
||||||
|
|
||||||
def has_meta_data_boolean?(key)
|
def has_meta_data_boolean?(key)
|
||||||
meta_data_string(key) == 'true'
|
meta_data_string(key) == 'true'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue