aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-10-03 15:58:22 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-10-03 15:58:22 -0700
commit2de0ccafdd0dbb11070bb8ffd43e76adb7c197f0 (patch)
tree5dc762b2b0d0be0c33a0b1bdf8e992d433935bed /activerecord/lib/active_record
parent1a193bdc632f99cae09b1657a74a5bc80c946ad6 (diff)
downloadrails-2de0ccafdd0dbb11070bb8ffd43e76adb7c197f0.tar.gz
rails-2de0ccafdd0dbb11070bb8ffd43e76adb7c197f0.tar.bz2
rails-2de0ccafdd0dbb11070bb8ffd43e76adb7c197f0.zip
inject down the hash cache
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/associations/join_dependency.rb5
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