diff options
author | Francesco Rodriguez <lrodriguezsanc@gmail.com> | 2012-07-04 22:39:16 -0500 |
---|---|---|
committer | Francesco Rodriguez <lrodriguezsanc@gmail.com> | 2012-07-04 22:39:16 -0500 |
commit | b5bb35355d68eab0343637980a231c8a4eb6093c (patch) | |
tree | 03d7d01990ba871f9c7e7491832b29755ffb9b96 /activerecord/lib | |
parent | a66f498955edf8e000751ffc38d42be307adcef5 (diff) | |
download | rails-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')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/quoting.rb | 2 |
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}'" |