mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
serialize_ids doesn't use source serializer and it's object
This commit is contained in:
@@ -384,7 +384,12 @@ module ActiveModel
|
||||
association = association_class.new(name, self, options)
|
||||
|
||||
if association.embed_ids?
|
||||
node[association.key] = association.serialize_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
|
||||
|
||||
if association.embed_in_root? && hash.nil?
|
||||
raise IncludeError.new(self.class, association.name)
|
||||
|
||||
Reference in New Issue
Block a user