Method: ActiveRecord::Associations::Builder::HasOne.touch_record

Defined in:
activerecord/lib/active_record/associations/builder/has_one.rb

.touch_record(record, name, touch) ⇒ Object



37
38
39
40
41
42
43
44
# File 'activerecord/lib/active_record/associations/builder/has_one.rb', line 37

def self.touch_record(record, name, touch)
  instance = record.send(name)

  if instance&.persisted?
    touch != true ?
      instance.touch(touch) : instance.touch
  end
end