diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-12-15 20:07:41 +0000 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-12-15 20:45:37 +0000 |
commit | ceb33f84933639d3b61aac62e5e71fd087ab65ed (patch) | |
tree | 1b8fcb8f19d37c5faa0a4d63dd52d369fbaad5b1 /activerecord/lib/active_record/attribute_methods | |
parent | 8854bf29a3590771aa989eb7e4b79f31eba9d96d (diff) | |
download | rails-ceb33f84933639d3b61aac62e5e71fd087ab65ed.tar.gz rails-ceb33f84933639d3b61aac62e5e71fd087ab65ed.tar.bz2 rails-ceb33f84933639d3b61aac62e5e71fd087ab65ed.zip |
Split out most of the AR::Base code into separate modules :cake:
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods')
-rw-r--r-- | activerecord/lib/active_record/attribute_methods/write.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/write.rb b/activerecord/lib/active_record/attribute_methods/write.rb index 07499db9f0..fde55b95da 100644 --- a/activerecord/lib/active_record/attribute_methods/write.rb +++ b/activerecord/lib/active_record/attribute_methods/write.rb @@ -49,6 +49,18 @@ module ActiveRecord value end end + + def convert_number_column_value(value) + if value == false + 0 + elsif value == true + 1 + elsif value.is_a?(String) && value.blank? + nil + else + value + end + end end end end |