[LRUG] Binding the creation of 2+ objects together
Anthony Green
email at acgreen.co.uk
Thu Jul 31 09:39:07 PDT 2008
I thought transactions were usually called within a controller ?
What I'm looking for is a solution defined as part of the association
declaration thereby enforcing the business rules the objects have.
..or similar
Tony
On 31/07/2008 17:09, "Alex Tomlins" <alex at tomlins.org.uk> wrote:
> This strikes me as an ideal case for transactions
>
> http://rails-doc.org/rails/ActiveRecord/Transactions/ClassMethods
>
> then you can use the save! methods, so if one of the models fails to
> save, an exception will be thrown, and the transaction rolled back.
>
> Alex
More information about the Chat
mailing list