I have a model with a has_and_belongs_to_many relationship that I''d like to bulk-assign a bunch of IDs to, as well as other attributes. Is there any way I can do this in a transaction without having to explicitly demarcate it? Code looks something like this: class Resource has_and_belongs_to_many :groups end class ResourceController def update @resource = Resource.find(params[:id]) @resource.group_ids = params[:group_ids].split('','') if @resource.update_attributes(params[:resource]) ... What I find is that as soon as I call group_ids, the changes are written to the database. I want it to happen in the same transaction that update_attributes uses. I''d rather not have to declare a transaction block, because there are already relationships between these objects. Any ideas? Thanks, Ben --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---