How do you prevent Rails from saving many-to-many updates on a model
object?
I have an edit page for a model object which has a table on it
represented
by a has-many relationship. Each table row consists of a label and a
series
of checkboxes. I am trying to allow the user to add/remove rows from
this
table (using AJAX), but then either Cancel or Save the updates along
with
the rest of the info on the page.
Whenever the AJAX calls update the backing model, the relationships are
saved in the database rather than held in memory. Is there a way to
prevent
this, or enable some sort of transaction across http requests, that can
rollback in the case of a cancel?
Or is there a better way to accomplish this?
Thanks,
- chopper