instance method
_touch_row
Ruby on Rails 7.0.10
Since v6.0.6 PrivateSignature
_touch_row(attribute_names, time)
No documentation comment.
Parameters
-
attribute_namesreq -
timereq
Source
# File activerecord/lib/active_record/attribute_methods/dirty.rb, line 190
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
Defined in activerecord/lib/active_record/attribute_methods/dirty.rb line 190
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::AttributeMethods::Dirty