Class: MR::FakeRecord::BelongsToAssociation

Inherits:
OneToOneAssociation show all
Defined in:
lib/mr/fake_record/associations.rb

Direct Known Subclasses

PolymorphicBelongsToAssociation

Instance Attribute Summary

Attributes inherited from Association

#owner, #reflection

Instance Method Summary collapse

Methods inherited from OneToOneAssociation

#read, #write

Methods inherited from Association

#<=>, #initialize, #klass, #read, #write

Constructor Details

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

Instance Method Details

#write_attributes(associated_fake_record) ⇒ Object



234
235
236
237
238
# File 'lib/mr/fake_record/associations.rb', line 234

def write_attributes(associated_fake_record)
  super
  associated_id = associated_fake_record.id
  @owner.send("#{self.reflection.foreign_key}=", associated_id)
end