Class: MR::FakeRecord::OneToOneAssociation

Inherits:
Association
  • Object
show all
Defined in:
lib/mr/fake_record/associations.rb

Direct Known Subclasses

BelongsToAssociation

Defined Under Namespace

Classes: NullClass, NullRecord

Instance Attribute Summary

Attributes inherited from Association

#owner, #reflection

Instance Method Summary collapse

Methods inherited from Association

#<=>, #initialize, #klass

Constructor Details

This class inherits a constructor from MR::FakeRecord::Association

Instance Method Details

#readObject



203
204
205
# File 'lib/mr/fake_record/associations.rb', line 203

def read
  @owner.instance_variable_get(@ivar_name)
end

#write(value) ⇒ Object



207
208
209
210
211
# File 'lib/mr/fake_record/associations.rb', line 207

def write(value)
  @owner.instance_variable_set(@ivar_name, value)
  write_attributes(value || NULL_RECORD)
  value
end