Hello Jonathan,

What you want is a transaction:

2007/1/22, Jonathan Viney <[EMAIL PROTECTED]>:

Group.transaction do

> g = Group.find(:first)
> g.person_ids = [1,2] # The database is updated here, unless g is a new
> record
> g.save # false

end

Be sure to use g.save! to ensure an exception is thrown, or else the
transaction will complete successfully.

Hope that helps !
-- 
François Beausoleil
http://blog.teksol.info/
http://piston.rubyforge.org/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to