Class: MR::FakeRecord::OneToManyAssociation
Instance Attribute Summary
Attributes inherited from Association
#owner, #reflection
Instance Method Summary
collapse
Methods inherited from Association
#<=>, #initialize, #klass
Instance Method Details
#read ⇒ Object
223
224
225
226
|
# File 'lib/mr/fake_record/associations.rb', line 223
def read
@owner.instance_variable_get(@ivar_name) ||
@owner.instance_variable_set(@ivar_name, [])
end
|
#write(value) ⇒ Object
228
229
230
|
# File 'lib/mr/fake_record/associations.rb', line 228
def write(value)
@owner.instance_variable_set(@ivar_name, [*value].compact)
end
|