Implement has_one's and serialize_ids

This commit is contained in:
Santiago Pastorino
2013-08-09 21:19:14 -03:00
parent 01bc534976
commit d756ae4a70
4 changed files with 136 additions and 4 deletions

14
test/fixtures/poro.rb vendored
View File

@@ -6,6 +6,14 @@ class Model
def read_attribute_for_serialization(name)
@attributes[name]
end
def model
@model ||= Model.new(attr1: 'v1', attr2: 'v2')
end
def id
object_id
end
end
class ModelSerializer < ActiveModel::Serializer
@@ -20,3 +28,9 @@ class ModelSerializer < ActiveModel::Serializer
attributes :attr1, :attr2
end
class AnotherSerializer < ActiveModel::Serializer
attributes :attr2, :attr3
has_one :model
end