aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
diff options
context:
space:
mode:
authorFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-07-04 22:39:16 -0500
committerFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-07-04 22:39:16 -0500
commitb5bb35355d68eab0343637980a231c8a4eb6093c (patch)
tree03d7d01990ba871f9c7e7491832b29755ffb9b96 /activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
parenta66f498955edf8e000751ffc38d42be307adcef5 (diff)
downloadrails-b5bb35355d68eab0343637980a231c8a4eb6093c.tar.gz
rails-b5bb35355d68eab0343637980a231c8a4eb6093c.tar.bz2
rails-b5bb35355d68eab0343637980a231c8a4eb6093c.zip
fix quoting for ActiveSupport::Duration instances
This patch fixes quoting for ActiveSupport::Duration instances: # before >> ActiveRecord::Base.connection.quote 30.minutes => "'--- 1800\n...\n'" # after >> ActiveRecord::Base.connection.quote 30.minutes => "1800" Also, adds a test for type casting ActiveSupport::Duration instances. Related to #1119.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract/quoting.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/quoting.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
index 6f9f0399db..60a9eee7c7 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
@@ -31,7 +31,7 @@ module ActiveRecord
# BigDecimals need to be put in a non-normalized form and quoted.
when nil then "NULL"
when BigDecimal then value.to_s('F')
- when Numeric then value.to_s
+ when Numeric, ActiveSupport::Duration then value.to_s
when Date, Time then "'#{quoted_date(value)}'"
when Symbol then "'#{quote_string(value.to_s)}'"
when Class then "'#{value.to_s}'"