2013-03-14 14:45:29 -04:00
|
|
|
class SuggestedTopicSerializer < ListableTopicSerializer
|
2013-02-05 14:16:51 -05:00
|
|
|
|
2016-02-03 02:50:05 -05: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
|
|
|
|
|
2013-11-19 13:35:51 -05:00
|
|
|
attributes :archetype, :like_count, :views, :category_id
|
2016-02-03 02:50:05 -05:00
|
|
|
has_many :posters, serializer: SuggestedPosterSerializer, embed: :objects
|
|
|
|
|
|
|
|
def include_posters?
|
|
|
|
object.private_message?
|
|
|
|
end
|
2013-02-05 14:16:51 -05:00
|
|
|
|
2016-02-03 02:50:05 -05:00
|
|
|
def posters
|
|
|
|
object.posters || []
|
|
|
|
end
|
2013-02-05 14:16:51 -05:00
|
|
|
end
|