Class: ActiveRecord::Associations::HasOneThroughAssociation

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

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Association

#inversed, #owner, #reflection, #target

Instance Method Summary collapse

Methods inherited from HasOneAssociation

#delete, #handle_dependency

Methods inherited from SingularAssociation

#build, #create, #create!, #reader, #writer

Methods inherited from Association

#aliased_table_name, #association_scope, #initialize, #initialize_attributes, #interpolate, #klass, #load_target, #loaded!, #loaded?, #marshal_dump, #marshal_load, #reload, #reset, #reset_scope, #scope, #scoped, #set_inverse_instance, #stale_target?, #target_scope

Constructor Details

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

Instance Method Details

#replace(record) ⇒ Object



7
8
9
10
# File 'lib/active_record/associations/has_one_through_association.rb', line 7

def replace(record)
  create_through_record(record)
  self.target = record
end