From 2de0ccafdd0dbb11070bb8ffd43e76adb7c197f0 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 3 Oct 2013 15:58:22 -0700 Subject: inject down the hash cache --- activerecord/lib/active_record/associations/join_dependency.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'activerecord/lib/active_record') 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 -- cgit v1.2.3