Preventing auto-save of related model objects

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

On Mar 27, 11:24 am, chopper [email protected] wrote:

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

Transactions across http requests would be a bad thing. How do you
guarantee commit/rollback happens, prevent records from being locked
indefinately or records from being updated before commit/rollback?

I’m not a ruby expert but I am working on a similar problem and I
posted a question about this 2 weeks ago and got no responses.

I am interested to see how you are handling the many to many in your
rhtml and controller.

If you post your rhtml file and the relevent controller functions I
may be able to help.

Cheers
Reed