Class: ActiveRecord::Associations::HasOneThroughAssociation

Inherits:
HasOneAssociation show all
Includes:
ThroughAssociation
Defined in:
lib/active_record/associations/has_one_through_association.rb

Overview

Active Record Has One Through Association

Instance Attribute Summary

Attributes inherited from Association

#inversed, #owner, #reflection, #target

Instance Method Summary collapse

Methods inherited from HasOneAssociation

#delete, #handle_dependency

Methods included from ForeignAssociation

#foreign_key_present?

Methods inherited from SingularAssociation

#build, #force_reload_reader, #reader, #writer

Methods inherited from Association

#association_scope, #create, #create!, #extensions, #initialize, #initialize_attributes, #klass, #load_target, #loaded!, #loaded?, #marshal_dump, #marshal_load, #reload, #remove_inverse_instance, #reset, #reset_scope, #scope, #set_inverse_instance, #stale_target?, #target_scope

Constructor Details

This class inherits a constructor from ActiveRecord::Associations::Association

Instance Method Details

#replace(record, save = true) ⇒ Object



9
10
11
12
# File 'lib/active_record/associations/has_one_through_association.rb', line 9

def replace(record, save = true)
  create_through_record(record, save)
  self.target = record
end