[LRUG] Binding the creation of 2+ objects together

Pratik Naik pratik at thinkwares.com
Thu Jul 31 11:03:47 PDT 2008


Create associated record in after_create and save it with save!. Those
callbacks are wrapped inside transaction. Raising exception should
rollback the transaction.

On Thu, Jul 31, 2008 at 5:04 PM, Anthony Green <email at acgreen.co.uk> wrote:
>
> Has anyone encountered a situation in which the business rules state that a
> object can't be saved unless its twin is saved too ?
>
> I'm seeing this is pattern repeated where an object with a has_one
> relationship to a twin is created but you need to check its twin has created
> as well and that both will save. You can't create one entry in a table
> without a corresponding entry in a different table.
>
> Does anyone know of an extension to the association declaration that
> enforces these kind of rules. A source of creation version of :dependent =>
> :destroy
>
> Tony
>
>
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>



-- 
http://m.onkey.org



More information about the Chat mailing list