Class: DuckRecord::Associations::HasOneAssociation

Inherits:
SingularAssociation show all
Defined in:
lib/duck_record/associations/has_one_association.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Association

#owner, #reflection, #target

Instance Method Summary collapse

Methods inherited from SingularAssociation

#build, #force_reload_reader, #reader, #writer

Methods inherited from Association

#initialize, #initialize_attributes, #klass, #marshal_dump, #marshal_load, #reset

Constructor Details

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

Instance Method Details

#replace(record) ⇒ Object



5
6
7
8
9
# File 'lib/duck_record/associations/has_one_association.rb', line 5

def replace(record)
  raise_on_type_mismatch!(record) if record

  self.target = record
end