Fixes #1211 - retrieve the key from the reflection options when building associations

This commit is contained in:
Liam Bowen
2015-09-29 16:18:47 +00:00
committed by L. Preston Sego III
parent 1f08865a10
commit f8323fc9e5
3 changed files with 20 additions and 1 deletions

View File

@@ -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