| Wonderful... transactions did the trick! @account = Account.new(params[:account]) @user = User.new(params[:user]) Account.transaction do if @account.save and @user.save then @saved = true end end if @saved @account.users << @user # Do something cool end What was really throwing me off last time was I was trying to use nested transactions when I didn't need to. This quote from the wiki is what did it for me: You only need to do this if Account and User are in different databases. If they’re different tables in the same database, you can pass your code block into Account.transaction or User.transaction, whichever makes more sense. On Aug 20, 2006, at 9:24 AM, Stephen Waits wrote: On Aug 18, 2006, at 9:10 PM, Nick Zadrozny wrote:
Definitely transactions. --Steve _______________________________________________ Sdruby mailing list |
_______________________________________________ Sdruby mailing list [email protected] http://lists.sdruby.com/mailman/listinfo/sdruby
