diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-06-21 05:37:36 -0700 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-06-21 05:37:36 -0700 |
commit | e76ced062078e1aeffcb963d28f144fe5e169139 (patch) | |
tree | debff293d5e89aa677b89097dc353b90d90b044b | |
parent | 682d247ca4a273e590e7ffd915e6463fab4f016e (diff) | |
parent | c3a5be012955a19d4bf52fd1589c373955b1a2cd (diff) | |
download | rails-e76ced062078e1aeffcb963d28f144fe5e169139.tar.gz rails-e76ced062078e1aeffcb963d28f144fe5e169139.tar.bz2 rails-e76ced062078e1aeffcb963d28f144fe5e169139.zip |
Merge pull request #6804 from acapilleri/firm_changes_from_zero_to_string
changed the firm of changes_from_zero_to_string?
-rw-r--r-- | activerecord/lib/active_record/attribute_methods/dirty.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/dirty.rb b/activerecord/lib/active_record/attribute_methods/dirty.rb index a85b6b3b82..a24b4b7839 100644 --- a/activerecord/lib/active_record/attribute_methods/dirty.rb +++ b/activerecord/lib/active_record/attribute_methods/dirty.rb @@ -78,7 +78,7 @@ module ActiveRecord def _field_changed?(attr, old, value) if column = column_for_attribute(attr) if column.number? && (changes_from_nil_to_empty_string?(column, old, value) || - changes_from_zero_to_string?(column, old, value)) + changes_from_zero_to_string?(old, value)) value = nil else value = column.type_cast(value) @@ -96,7 +96,7 @@ module ActiveRecord column.null && (old.nil? || old == 0) && value.blank? end - def changes_from_zero_to_string?(column, old, value) + def changes_from_zero_to_string?(old, value) # For columns with old 0 and value non-empty string old == 0 && value.present? && value != '0' end |