From ceb33f84933639d3b61aac62e5e71fd087ab65ed Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Thu, 15 Dec 2011 20:07:41 +0000 Subject: Split out most of the AR::Base code into separate modules :cake: --- activerecord/lib/active_record/attribute_methods/write.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'activerecord/lib/active_record/attribute_methods') 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 -- cgit v1.2.3