diff options
author | Josh Susser <josh@hasmanythrough.com> | 2008-08-18 15:56:37 -0700 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-08-21 19:33:25 +0200 |
commit | aee14630d4dc0856e597794cc731fac68c2d2e34 (patch) | |
tree | f3ad416bc299563352fcaa70c1bb15cad6191ca7 /activerecord/lib/active_record/connection_adapters | |
parent | 8622787f8748434b4ceb2b925a35b17a38e1f2d6 (diff) | |
download | rails-aee14630d4dc0856e597794cc731fac68c2d2e34.tar.gz rails-aee14630d4dc0856e597794cc731fac68c2d2e34.tar.bz2 rails-aee14630d4dc0856e597794cc731fac68c2d2e34.zip |
coerce blank strings to nil values for boolean and integer fields
Signed-off-by: Michael Koziarski <michael@koziarski.com>
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb index 31d6c7942c..08b2c79389 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb @@ -138,7 +138,11 @@ module ActiveRecord # convert something to a boolean def value_to_boolean(value) - TRUE_VALUES.include?(value) + if value.blank? + nil + else + TRUE_VALUES.include?(value) + end end # convert something to a BigDecimal |