discourse/app/serializers/suggested_topic_serializer.rb

21 lines
554 B
Ruby
Raw Normal View History

class SuggestedTopicSerializer < ListableTopicSerializer
2013-02-06 03:16:51 +08:00
# need to embed so we have users
# front page json gets away without embedding
class SuggestedPosterSerializer < ApplicationSerializer
attributes :extras, :description
has_one :user, serializer: BasicUserSerializer, embed: :objects
end
attributes :archetype, :like_count, :views, :category_id
has_many :posters, serializer: SuggestedPosterSerializer, embed: :objects
def include_posters?
object.private_message?
end
2013-02-06 03:16:51 +08:00
def posters
object.posters || []
end
2013-02-06 03:16:51 +08:00
end