method
_touch_row
v7.2.3 -
Show latest stable
- Class:
ActiveRecord::AttributeMethods::Dirty
_touch_row(attribute_names, time)private
No documentation available.
# File activerecord/lib/active_record/attribute_methods/dirty.rb, line 204
def _touch_row(attribute_names, time)
@_touch_attr_names = Set.new(attribute_names)
affected_rows = super
if @_skip_dirty_tracking ||= false
clear_attribute_changes(@_touch_attr_names)
return affected_rows
end
changes = {}
@attributes.keys.each do |attr_name|
next if @_touch_attr_names.include?(attr_name)
if attribute_changed?(attr_name)
changes[attr_name] = _read_attribute(attr_name)
_write_attribute(attr_name, attribute_was(attr_name))
clear_attribute_change(attr_name)
end
end
changes_applied
changes.each { |attr_name, value| _write_attribute(attr_name, value) }
affected_rows
ensure
@_touch_attr_names, @_skip_dirty_tracking = nil, nil
end