metamaps--metamaps/app/serializers/mapping_serializer.rb
2016-03-11 17:16:04 +11:00

17 lines
420 B
Ruby

class MappingSerializer < ActiveModel::Serializer
embed :ids, include: true
attributes :id,
:xloc,
:yloc,
:created_at,
:updated_at
has_one :user
has_one :map
has_one :mappable, polymorphic: true
def filter(keys)
keys.delete(:xloc) unless object.mappable_type == "Topic"
keys.delete(:yloc) unless object.mappable_type == "Topic"
keys
end
end