method
_touch_row
Ruby on Rails latest stable (v7.1.3.2)
-
0 notes -
Class: ActiveRecord::AttributeMethods::Dirty
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0
- 3.0.9
- 3.1.0
- 3.2.1
- 3.2.8
- 3.2.13
- 4.0.2
- 4.1.8
- 4.2.1
- 4.2.7
- 4.2.9
- 5.0.0.1
- 5.1.7
- 5.2.3
- 6.0.0 (0)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (0)
- 7.1.3.2 (0)
- 7.1.3.4 (0)
- What's this?
_touch_row(attribute_names, time)
private
Hide source
# 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