Permalink
Browse files

inject down the hash cache

  • Loading branch information...
1 parent 1a193bd commit 2de0ccafdd0dbb11070bb8ffd43e76adb7c197f0 @tenderlove tenderlove committed Oct 3, 2013
Showing with 2 additions and 3 deletions.
  1. +2 −3 activerecord/lib/active_record/associations/join_dependency.rb
@@ -123,9 +123,8 @@ def cache_joined_association(association)
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

0 comments on commit 2de0cca

Please sign in to comment.