2016-03-11 22:48:07 +00:00
|
|
|
class NewMappingSerializer < ActiveModel::Serializer
|
2016-03-11 06:16:04 +00:00
|
|
|
attributes :id,
|
|
|
|
:xloc,
|
|
|
|
:yloc,
|
|
|
|
:created_at,
|
2016-03-12 15:28:39 +00:00
|
|
|
:updated_at,
|
|
|
|
:mappable_id,
|
|
|
|
:mappable_type
|
|
|
|
|
2016-03-11 22:48:07 +00:00
|
|
|
has_one :user, serializer: NewUserSerializer
|
|
|
|
has_one :map, serializer: NewMapSerializer
|
2016-03-11 06:16:04 +00:00
|
|
|
|
|
|
|
def filter(keys)
|
|
|
|
keys.delete(:xloc) unless object.mappable_type == "Topic"
|
|
|
|
keys.delete(:yloc) unless object.mappable_type == "Topic"
|
|
|
|
keys
|
|
|
|
end
|
|
|
|
end
|