Transactions in RoR


#1

Hi,
Does anyone knows how to manage transactions in RoR.

Thanx


#2

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/Transactions/
ClassMethods.html


– Tom M.


#3

You can’t do transactions over multiple databases though.

Tom M. 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/Transactions/
ClassMethods.html


– Tom M.


#4

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.


#5

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 H. wrote:

On 5/16/06, Hampton removed_email_address@domain.invalid 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


#6

On 5/16/06, Hampton removed_email_address@domain.invalid 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