Hello,
I have two models, Publication and Person, that are connected via a has
many - through association (join-model: Contribution). I have a
Publication-object that has already been persisted (i.e. new_record?
evaluates to false) and would like to do the following:
-
adding a Person-object that has already been persisted as well to
that publication without the new relationship automatically being saved
on db-level
(.i.e. no new record should be added to the contributions-join table
automatically) -
removing a Person-object from the publication without automatically
deleting the contributions-record on db-level that links the publication
and the person
As far as I know the methods ‘publication.people <<’ (and similar stuff
like concat and push) as well as ‘publication.people delete’ will
automatically perform the persistence-operations I would like to avoid.
The only method that allows to add associates without performing
persistence operations is publication.people.build. But that only adds a
new person (new_record? = true), not one which has already been saved.
So my question is:
IS there any way to achieve 1) or/and 2), or is Active-Record with its
tight coupling of objects and db-records just the ‘wrong’
object-relational mapper to achieve this?