metamaps--metamaps/app/serializers/api/v1/mapping_serializer.rb

26 lines
484 B
Ruby
Raw Normal View History

2016-08-20 12:32:18 +08:00
module Api
module V1
2016-08-20 13:44:26 +08:00
class MappingSerializer < ApplicationSerializer
2016-08-20 12:32:18 +08:00
attributes :id,
:created_at,
:updated_at,
:mappable_id,
:mappable_type
2016-08-20 13:44:26 +08:00
attribute :xloc, if: -> { object.mappable_type == 'Topic' }
attribute :yloc, if: -> { object.mappable_type == 'Topic' }
2016-08-20 12:32:18 +08:00
2016-08-20 13:44:26 +08:00
def self.embeddable
{
user: {},
map: {}
}
end
self.class_eval do
embed_dat
2016-08-20 12:32:18 +08:00
end
end
end
end