@@ -447,7 +447,7 module ActiveRecord #:nodoc: | |||||
447 |
|
447 | |||
448 | def write_changed_attribute(attr_name, attr_value) |
|
448 | def write_changed_attribute(attr_name, attr_value) | |
449 | # Convert to db type for comparison. Avoids failing Float<=>String comparisons. |
|
449 | # Convert to db type for comparison. Avoids failing Float<=>String comparisons. | |
450 | attr_value_for_db = self.class.columns_hash[attr_name.to_s].type_cast(attr_value) |
|
450 | attr_value_for_db = self.class.columns_hash[attr_name.to_s].type_cast_from_database(attr_value) | |
451 | (self.altered_attributes ||= []) << attr_name.to_s unless self.changed?(attr_name) || self.send(attr_name) == attr_value_for_db |
|
451 | (self.altered_attributes ||= []) << attr_name.to_s unless self.changed?(attr_name) || self.send(attr_name) == attr_value_for_db | |
452 | write_attribute(attr_name, attr_value_for_db) |
|
452 | write_attribute(attr_name, attr_value_for_db) | |
453 | end |
|
453 | end |
General Comments 0
You need to be logged in to leave comments.
Login now