mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Fixes #1211 - retrieve the key from the reflection options when building associations
This commit is contained in:
committed by
L. Preston Sego III
parent
1f08865a10
commit
f8323fc9e5
@@ -92,7 +92,8 @@ module ActiveModel
|
||||
|
||||
Enumerator.new do |y|
|
||||
self.class._reflections.each do |reflection|
|
||||
next unless include_tree.key?(reflection.name)
|
||||
key = reflection.options.fetch(:key, reflection.name)
|
||||
next unless include_tree.key?(key)
|
||||
y.yield reflection.build_association(self, instance_options)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user