diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-10-12 13:13:19 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-10-12 13:13:19 -0700 |
commit | 25a2909355891fc3cbe3f5036191131e9d301580 (patch) | |
tree | 9b15f33f12e16c9c5b430ae8a9fa74eccf172cb0 | |
parent | 4b2e16ed248d294133b8c5212f5facac78625e42 (diff) | |
download | rails-25a2909355891fc3cbe3f5036191131e9d301580.tar.gz rails-25a2909355891fc3cbe3f5036191131e9d301580.tar.bz2 rails-25a2909355891fc3cbe3f5036191131e9d301580.zip |
dry up column type testing
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/quoting.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb index a3928b4504..a7a12faac2 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb @@ -14,12 +14,12 @@ module ActiveRecord value = value.to_s return "'#{quote_string(value)}'" unless column - if column.type == :binary - "'#{quote_string(column.string_to_binary(value))}'" # ' (for ruby-mode) - elsif [:integer, :float].include?(column.type) - (column.type == :integer ? value.to_i : value.to_f).to_s + case column.type + when :binary then "'#{quote_string(column.string_to_binary(value))}'" + when :integer then value.to_i.to_s + when :float then value.to_f.to_s else - "'#{quote_string(value)}'" # ' (for ruby-mode) + "'#{quote_string(value)}'" end when true, false |