diff options
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/query_cache.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/query_cache.rb b/activerecord/lib/active_record/query_cache.rb index 9296c5b81a..191e5a3d97 100644 --- a/activerecord/lib/active_record/query_cache.rb +++ b/activerecord/lib/active_record/query_cache.rb @@ -58,8 +58,14 @@ module ActiveRecord else @query_cache[sql] = yield end - - result ? result.dup : nil + + if result + # perform a deep #dup in case result is an array + result = result.collect { |row| row.dup } if result.respond_to?(:collect) + result.dup + else + nil + end end def method_missing(method, *arguments, &proc) |