Closed liveh2o closed 7 years ago
It would seem perform_association
only defines reader methods with no arguments.
I'm working on an addition that will also create writer methods as needed.
Nice. It would be really helpful to be able to set the instance variable to avoid unnecessary lookups.
Two question though:
1.) Should we have similar functionality with has_one
?
2.) Should a remote object that doesn't exist be created if assigned using a writer method?
I would think all association methods would get setters: belongs_to
, has_one
, has_many
.
I'd say we should shy away from automatically creating associated records for now to limit the scope. We can make that future functionality.
For some reason, defining an association (i.e.
belongs_to
) only defines an attribute reader. It should also provide an attribute writer.