diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-10-12 11:38:40 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-10-12 11:38:40 -0700 |
commit | ef11ce2af85cb2171343ba1685fc5483929286bd (patch) | |
tree | 8db15b020aeca32474cc773f28abfcd76b18ef36 /activerecord/lib | |
parent | 98cb754cd7fee6203646947422600fccc6e00818 (diff) | |
download | rails-ef11ce2af85cb2171343ba1685fc5483929286bd.tar.gz rails-ef11ce2af85cb2171343ba1685fc5483929286bd.tar.bz2 rails-ef11ce2af85cb2171343ba1685fc5483929286bd.zip |
fixing case / when indentation
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/quoting.rb | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb index e2b3773a99..9967da6b56 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb @@ -10,28 +10,28 @@ module ActiveRecord return value.quoted_id if value.respond_to?(:quoted_id) case value - when String, ActiveSupport::Multibyte::Chars - value = value.to_s - if column && column.type == :binary && column.class.respond_to?(:string_to_binary) - "'#{quote_string(column.class.string_to_binary(value))}'" # ' (for ruby-mode) - elsif column && [:integer, :float].include?(column.type) - value = column.type == :integer ? value.to_i : value.to_f - value.to_s - 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 + when String, ActiveSupport::Multibyte::Chars + value = value.to_s + if column && column.type == :binary && column.class.respond_to?(:string_to_binary) + "'#{quote_string(column.class.string_to_binary(value))}'" # ' (for ruby-mode) + elsif column && [:integer, :float].include?(column.type) + value = column.type == :integer ? value.to_i : value.to_f + value.to_s + 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 BigDecimal then value.to_s('F') + else + if value.acts_like?(:date) || value.acts_like?(:time) + "'#{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 end |