discourse/app/serializers/suggested_topic_serializer.rb

12 lines
292 B
Ruby
Raw Normal View History

class SuggestedTopicSerializer < ListableTopicSerializer
2013-02-06 03:16:51 +08:00
attributes :archetype, :like_count, :views, :last_post_age
2013-02-06 03:16:51 +08:00
has_one :category, embed: :objects
def last_post_age
return nil if object.last_posted_at.blank?
AgeWords.age_words(Time.now - object.last_posted_at)
end
2013-02-07 23:45:24 +08:00
2013-02-06 03:16:51 +08:00
end