metamaps--metamaps/app/serializers/new_mapping_serializer.rb

18 lines
488 B
Ruby
Raw Normal View History

2016-03-11 22:48:07 +00:00
class NewMappingSerializer < ActiveModel::Serializer
embed :ids, include: true
attributes :id,
:xloc,
:yloc,
:created_at,
:updated_at
2016-03-11 22:48:07 +00:00
has_one :user, serializer: NewUserSerializer
has_one :map, serializer: NewMapSerializer
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