Forum: Ruby on Rails Transactions in RoR

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
4eed769209bb61b17593134235873386?d=identicon&s=25 Ovidiu EFTIMIE (Guest)
on 2006-05-16 09:19
(Received via mailing list)
Hi,
Does anyone knows how to manage transactions in RoR.

Thanx
59de94a56fd2c198f33d9515d1c05961?d=identicon&s=25 Tom Mornini (Guest)
on 2006-05-16 10:39
(Received via mailing list)
On May 16, 2006, at 12:18 AM, Ovidiu EFTIMIE wrote:

> Does anyone knows how to manage transactions in RoR.

http://api.rubyonrails.com/classes/ActiveRecord/Tr...
ClassMethods.html

--
-- Tom Mornini
167a3b5582230623eb94e638133122ec?d=identicon&s=25 Kris (Guest)
on 2006-05-16 15:15
You can't do transactions over multiple databases though.


Tom Mornini wrote:
> On May 16, 2006, at 12:18 AM, Ovidiu EFTIMIE wrote:
>
>> Does anyone knows how to manage transactions in RoR.
>
> http://api.rubyonrails.com/classes/ActiveRecord/Tr...
> ClassMethods.html
>
> --
> -- Tom Mornini
A77873df3a9766b208e009248a2a9a56?d=identicon&s=25 Hampton (Guest)
on 2006-05-16 16:45
(Received via mailing list)
Kris-

At this point, to my knowledge, there isn't a shabam! sort of way to do
multiple database transactions in a super clean way.

But, there are two 'hackish' solutions. If your database has inline
transaction handling then just use the facilities to write your own SQL
to
one db to perform the transaction on both. (Some dbs can do this).

You can also nest your transactions. Its not perfect, nor is it pretty,
but
as long as each model has a seperate connection, then you are cool.

Check out the API for "transaction".

-hampton.
5233478c51a92b6a1a5c970cbf3a42f3?d=identicon&s=25 Isak Hansen (Guest)
on 2006-05-16 17:07
(Received via mailing list)
On 5/16/06, Hampton <hcatlin@gmail.com> wrote:
> as long as each model has a seperate connection, then you are cool.
>
> Check out the API for "transaction".
>
> -hampton.

I'd say you're better off with Java for distributed transactions. In
these SOA-times you could still do the web tier in Rails, though.

Isak
A544c72235bbeb3f5fd5b4cf7c00945d?d=identicon&s=25 kris (Guest)
on 2006-05-16 20:51
Hopefully JRuby will allow us to connect to a Java backend at some point
in the future.

When you say SOA, you mean a web service? So you would have a the Rails
app connect to a Java web service, passing one or more records. The Java
app would do the transaction and respond with OK or Fail??

Would you have just the database stuff in Java or the models as well?


Isak Hansen wrote:
> On 5/16/06, Hampton <hcatlin@gmail.com> wrote:
>> as long as each model has a seperate connection, then you are cool.
>>
>> Check out the API for "transaction".
>>
>> -hampton.
>
> I'd say you're better off with Java for distributed transactions. In
> these SOA-times you could still do the web tier in Rails, though.
>
> Isak
This topic is locked and can not be replied to.