From 25a2909355891fc3cbe3f5036191131e9d301580 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 12 Oct 2010 13:13:19 -0700 Subject: dry up column type testing --- .../lib/active_record/connection_adapters/abstract/quoting.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'activerecord/lib/active_record/connection_adapters') 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 -- cgit v1.2.3