Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Match Fixnum and Float in particular. Rescue dup error and return res…

…ult.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7420 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 7ace0a654c46cf9ca57f42981c826eace21fa42c 1 parent 2894887
@jeremy jeremy authored
Showing with 5 additions and 4 deletions.
  1. +5 −4 activerecord/lib/active_record/query_cache.rb
View
9 activerecord/lib/active_record/query_cache.rb
@@ -48,9 +48,8 @@ def delete(sql, name = nil)
clear_query_cache
@connection.delete(sql, name)
end
-
+
private
-
def cache(sql)
result = if @query_cache.has_key?(sql)
log_info(sql, "CACHE", 0.0)
@@ -62,13 +61,15 @@ def cache(sql)
case result
when Array
result.collect { |row| row.dup }
- when Fixnum, NilClass, FalseClass
+ when nil, Fixnum, Float, true, false
result
else
result.dup
end
+ rescue TypeError
+ result
end
-
+
def method_missing(method, *arguments, &proc)
@connection.send(method, *arguments, &proc)
end
Please sign in to comment.
Something went wrong with that request. Please try again.