diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-02-14 08:47:42 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-02-14 08:47:42 -0800 |
commit | 848c3d4ea306aa604997b20c11b21c24b931d4eb (patch) | |
tree | e1b2a6db52afa89c23462c35bc2917068a536777 /activerecord/lib | |
parent | abdff445fbd36e47fb1f3e3b6f49f819f2c37d44 (diff) | |
parent | bdb6c4ef86b814c7380600f3e01e149b718408c9 (diff) | |
download | rails-848c3d4ea306aa604997b20c11b21c24b931d4eb.tar.gz rails-848c3d4ea306aa604997b20c11b21c24b931d4eb.tar.bz2 rails-848c3d4ea306aa604997b20c11b21c24b931d4eb.zip |
Merge pull request #3544 from amatsuda/_field_changed
Rename field_changed? to _field_changed? so that users can create a field named field
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/attribute_methods/dirty.rb | 6 | ||||
-rw-r--r-- | activerecord/lib/active_record/core.rb | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/dirty.rb b/activerecord/lib/active_record/attribute_methods/dirty.rb index 40e4a97e73..433d508357 100644 --- a/activerecord/lib/active_record/attribute_methods/dirty.rb +++ b/activerecord/lib/active_record/attribute_methods/dirty.rb @@ -55,12 +55,12 @@ module ActiveRecord # The attribute already has an unsaved change. if attribute_changed?(attr) old = @changed_attributes[attr] - @changed_attributes.delete(attr) unless field_changed?(attr, old, value) + @changed_attributes.delete(attr) unless _field_changed?(attr, old, value) else old = clone_attribute_value(:read_attribute, attr) # Save Time objects as TimeWithZone if time_zone_aware_attributes == true old = old.in_time_zone if clone_with_time_zone_conversion_attribute?(attr, old) - @changed_attributes[attr] = old if field_changed?(attr, old, value) + @changed_attributes[attr] = old if _field_changed?(attr, old, value) end # Carry on. @@ -77,7 +77,7 @@ module ActiveRecord end end - def field_changed?(attr, old, value) + def _field_changed?(attr, old, value) if column = column_for_attribute(attr) if column.number? && column.null && (old.nil? || old == 0) && value.blank? # For nullable numeric columns, NULL gets stored in database for blank (i.e. '') values. diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb index c4a4c0ad9a..3f90d25962 100644 --- a/activerecord/lib/active_record/core.rb +++ b/activerecord/lib/active_record/core.rb @@ -223,7 +223,7 @@ module ActiveRecord @changed_attributes = {} self.class.column_defaults.each do |attr, orig_value| - @changed_attributes[attr] = orig_value if field_changed?(attr, orig_value, @attributes[attr]) + @changed_attributes[attr] = orig_value if _field_changed?(attr, orig_value, @attributes[attr]) end @aggregation_cache = {} |