serialize_ids call methods on the corresponding serializer if defined

This commit is contained in:
Santiago Pastorino
2013-05-23 17:34:03 -07:00
parent ee846f39af
commit 9521e912fe
3 changed files with 88 additions and 12 deletions

View File

@@ -382,12 +382,7 @@ module ActiveModel
association = association_class.new(name, options, self.options)
if association.embed_ids?
node[association.key] =
if options[:embed_key] || self.respond_to?(name) || !self.object.respond_to?(association.id_key)
association.serialize_ids
else
self.object.read_attribute_for_serialization(association.id_key)
end
node[association.key] = association.serialize_ids
if association.embed_in_root? && hash.nil?
raise IncludeError.new(self.class, association.name)