aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-10-12 11:41:23 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-10-12 11:41:23 -0700
commit31b132aa9b16bb66446839af888fdff4bad86bcf (patch)
tree5ea747037ec1128be7cbc2da07983de650fb3eb1 /activerecord/lib/active_record/connection_adapters/abstract
parentef11ce2af85cb2171343ba1685fc5483929286bd (diff)
downloadrails-31b132aa9b16bb66446839af888fdff4bad86bcf.tar.gz
rails-31b132aa9b16bb66446839af888fdff4bad86bcf.tar.bz2
rails-31b132aa9b16bb66446839af888fdff4bad86bcf.zip
refactoring date / time / datetime when statement
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/quoting.rb19
1 files changed, 8 insertions, 11 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
index 9967da6b56..39bd5e1cab 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
@@ -20,18 +20,15 @@ module ActiveRecord
else
"'#{quote_string(value)}'" # ' (for ruby-mode)
end
- when NilClass then "NULL"
- when TrueClass then (column && column.type == :integer ? '1' : quoted_true)
- when FalseClass then (column && column.type == :integer ? '0' : quoted_false)
- when Float, Fixnum, Bignum then value.to_s
- # BigDecimals need to be output in a non-normalized form and quoted.
- when BigDecimal then value.to_s('F')
+ when NilClass then "NULL"
+ when TrueClass then (column && column.type == :integer ? '1' : quoted_true)
+ when FalseClass then (column && column.type == :integer ? '0' : quoted_false)
+ when Float, Fixnum, Bignum then value.to_s
+ # BigDecimals need to be put in a non-normalized form and quoted.
+ when BigDecimal then value.to_s('F')
+ when Date, Time, DateTime then "'#{quoted_date(value)}'"
else
- if value.acts_like?(:date) || value.acts_like?(:time)
- "'#{quoted_date(value)}'"
- else
- "'#{quote_string(value.to_s)}'"
- end
+ "'#{quote_string(value.to_s)}'"
end
end