Class: ActiveRecord::Associations::Builder::HasOne

Inherits:
SingularAssociation show all
Defined in:
activerecord/lib/active_record/associations/builder/has_one.rb

Overview

:nodoc:

Constant Summary

Constants inherited from Association

Association::VALID_OPTIONS

Class Method Summary collapse

Methods inherited from Association

build, create_reflection

Class Method Details

.touch_record(record, name, touch) ⇒ Object


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

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

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