aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-05-01 10:41:45 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2012-05-01 10:41:45 -0700
commitb2a24a15785e94078bae87946ffa43bc59bccfec (patch)
treedc0ba06f14226a8611164697705218dfeb9757b0 /activerecord/lib/active_record
parent5722915fa7e172a5632b76023539f024e5711049 (diff)
parent13823a4cf35e99582c9b634a94c362d565b7841c (diff)
downloadrails-b2a24a15785e94078bae87946ffa43bc59bccfec.tar.gz
rails-b2a24a15785e94078bae87946ffa43bc59bccfec.tar.bz2
rails-b2a24a15785e94078bae87946ffa43bc59bccfec.zip
Merge pull request #6092 from jsanders/issue_4001_error_typecasting_non_integer_castable
Don't type cast values that don't respond to to_i to 1
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/connection_adapters/column.rb2
1 files changed, 1 insertions, 1 deletions
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)