Transactions (commit and rollback)

Miquel Oliete
2008-04-26T11:28:05Z

Hi there

I''m coding an action where I have to create two related objects
(models). The thing is that the second one uses the first one''s id
value as its id (the first tables''s id is autoincrement and the second
table''s id is not and get the value from the first table''s id.

How can I do to open a transaction in order to either create both
objects if everything is ok or create no object is something is wrong
(commit or rollback).

Thanks in advance

Regards

--

Miquel (a.k.a. Ktalà a.k.a. Ton)
Linux User  #286784
GPG Key : 4D91EF7F
Debian GNU/Linux (Linux wolverine 2.6.23.1)

Welcome to the jungle, we got fun and games
Guns n'' Roses

--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---