method
    
    touch_record
 
  
      v5.0.0.1 - 
      Show latest stable
 - 
    0 notes - 
    Class: BelongsTo
    
  
  
- 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 (0)
- 4.2.1 (0)
- 4.2.7 (0)
- 4.2.9 (0)
- 5.0.0.1 (0)
- 5.1.7 (0)
- 5.2.3 (0)
- 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_record(o, foreign_key, name, touch, touch_method)
  public
  
    Hide source    
    
      
  
# File activerecord/lib/active_record/associations/builder/belongs_to.rb, line 73 def self.touch_record(o, foreign_key, name, touch, touch_method) # :nodoc: old_foreign_id = o.changed_attributes[foreign_key] if old_foreign_id association = o.association(name) reflection = association.reflection if reflection.polymorphic? klass = o.public_send("#{reflection.foreign_type}_was").constantize else klass = association.klass end old_record = klass.find_by(klass.primary_key => old_foreign_id) if old_record if touch != true old_record.send(touch_method, touch) else old_record.send(touch_method) end end end record = o.send name if record && record.persisted? if touch != true record.send(touch_method, touch) else record.send(touch_method) end end end

 RSpec
RSpec Ruby on Rails
Ruby on Rails Ruby
Ruby 
   
    
     = protected
 = protected
  