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

28 lines
571 B
Ruby
Raw Permalink Normal View History

2016-09-24 03:00:46 +00:00
# frozen_string_literal: true
module Api
module V2
class MappingSerializer < ApplicationSerializer
attributes :id,
2016-09-24 03:00:46 +00:00
:created_at,
:updated_at,
:mappable_id,
:mappable_type
attribute :xloc, if: -> { object.mappable_type == 'Topic' }
attribute :yloc, if: -> { object.mappable_type == 'Topic' }
def self.embeddable
{
user: {},
updated_by: {},
map: {}
}
end
2016-09-24 03:00:46 +00:00
class_eval do
embed_dat
end
end
end
end