Class: MR::FakeRecord::PolymorphicBelongsToAssociation
- Inherits:
-
BelongsToAssociation
- Object
- Association
- OneToOneAssociation
- BelongsToAssociation
- MR::FakeRecord::PolymorphicBelongsToAssociation
- Defined in:
- lib/mr/fake_record/associations.rb
Instance Attribute Summary
Attributes inherited from Association
Instance Method Summary collapse
Methods inherited from OneToOneAssociation
Methods inherited from Association
#<=>, #initialize, #read, #write
Constructor Details
This class inherits a constructor from MR::FakeRecord::Association
Instance Method Details
#klass ⇒ Object
248 249 250 251 |
# File 'lib/mr/fake_record/associations.rb', line 248 def klass class_name = @owner.send(self.reflection.foreign_type) class_name.constantize if class_name end |
#write_attributes(associated_fake_record) ⇒ Object
242 243 244 245 246 |
# File 'lib/mr/fake_record/associations.rb', line 242 def write_attributes(associated_fake_record) super associated_type = associated_fake_record.class.name @owner.send("#{self.reflection.foreign_type}=", associated_type) end |