discourse/app/serializers/suggested_topic_serializer.rb
2016-07-05 10:10:12 +10:00

17 lines
496 B
Ruby

class SuggestedTopicSerializer < ListableTopicSerializer
# 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 posters
object.posters || []
end
end