From 13823a4cf35e99582c9b634a94c362d565b7841c Mon Sep 17 00:00:00 2001 From: James Sanders & Jason Noble Date: Mon, 30 Apr 2012 11:37:31 -0600 Subject: Don't type cast values that don't respond to to_i to 1 --- activerecord/lib/active_record/connection_adapters/column.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/connection_adapters/column.rb b/activerecord/lib/active_record/connection_adapters/column.rb index b7e1513422..9af8e46120 100644 --- a/activerecord/lib/active_record/connection_adapters/column.rb +++ b/activerecord/lib/active_record/connection_adapters/column.rb @@ -95,7 +95,7 @@ module ActiveRecord case type when :string, :text then value - when :integer then value.to_i rescue value ? 1 : 0 + when :integer then value.to_i when :float then value.to_f when :decimal then klass.value_to_decimal(value) when :datetime, :timestamp then klass.string_to_time(value) -- cgit v1.2.3