diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-09-08 04:53:29 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-09-08 04:53:29 +0000 |
commit | 7ace0a654c46cf9ca57f42981c826eace21fa42c (patch) | |
tree | 549776631ecdc37141d925fb8536fd4eef023add | |
parent | 2894887925a3613f1ea9f81bd72ec1f51c3e06da (diff) | |
download | rails-7ace0a654c46cf9ca57f42981c826eace21fa42c.tar.gz rails-7ace0a654c46cf9ca57f42981c826eace21fa42c.tar.bz2 rails-7ace0a654c46cf9ca57f42981c826eace21fa42c.zip |
Match Fixnum and Float in particular. Rescue dup error and return result.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7420 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | activerecord/lib/active_record/query_cache.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/query_cache.rb b/activerecord/lib/active_record/query_cache.rb index 1b15f92284..2cb9b97f8f 100644 --- a/activerecord/lib/active_record/query_cache.rb +++ b/activerecord/lib/active_record/query_cache.rb @@ -48,9 +48,8 @@ module ActiveRecord 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 @@ module ActiveRecord 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 |