diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-20 11:13:01 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-20 11:13:01 -0700 |
commit | d6edefb5a7c1ad56c464ce5ca273a2db736e7b6e (patch) | |
tree | 33d8e344e7f02712c92389f74d74152205f5c483 /lib | |
parent | d217e57a78a5df20fe1248bac864ad0da58b2dc6 (diff) | |
download | rails-d6edefb5a7c1ad56c464ce5ca273a2db736e7b6e.tar.gz rails-d6edefb5a7c1ad56c464ce5ca273a2db736e7b6e.tar.bz2 rails-d6edefb5a7c1ad56c464ce5ca273a2db736e7b6e.zip |
use object id as the weak ref key
Diffstat (limited to 'lib')
-rw-r--r-- | lib/arel/session.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/arel/session.rb b/lib/arel/session.rb index 6d115e7078..e6da825b97 100644 --- a/lib/arel/session.rb +++ b/lib/arel/session.rb @@ -33,9 +33,10 @@ module Arel end def read(select) - (@read ||= Hash.new do |hash, x| - hash[x] = x.call - end)[select] + @read ||= {} + key = select.object_id + return @read[key] if @read.key? key + @read[key] = select.call end def update(update) |