diff options
Diffstat (limited to 'activerecord/lib/active_record/associations/join_dependency.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/join_dependency.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/associations/join_dependency.rb b/activerecord/lib/active_record/associations/join_dependency.rb index 8f65c2b5d4..3acb50d73f 100644 --- a/activerecord/lib/active_record/associations/join_dependency.rb +++ b/activerecord/lib/active_record/associations/join_dependency.rb @@ -123,9 +123,8 @@ module ActiveRecord associations.unshift(parent.reflection.name) parent = parent.parent end - ref = @associations - associations.each do |key| - ref = ref[key] + ref = associations.inject(@associations) do |cache,key| + cache[key] end ref[association.reflection.name] ||= {} end |