metamaps--metamaps/app/serializers/api/v2/mapping_serializer.rb
Devin Howard e544d6a6db refactor api and fix bugs (#1088)
* fix weird double-embed issue

* fix users/current api if not logged in

* turbocharge the api

* fix docs
2017-03-09 14:24:52 -05:00

27 lines
599 B
Ruby

# frozen_string_literal: true
module Api
module V2
class MappingSerializer < ApplicationSerializer
attributes :id,
: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: { serializer: UserSerializer },
map: {}
}
end
class_eval do
embed_dat
end
end
end
end