Dear ALL:

I would like to ask, what is it true that rails already supports
transaction although we do not put ActiveRecord::Base.transaction in our
ruby controller or model script? - My DB ENGINE is InnoDB -

I did test in web browser with putting delay process inside of script to
make 2 concurrent process having collision, but the fact at final, they
are handled with transaction, i do not put any
ActiveRecord::Base.transaction or ModelName.transaction script there.

Example :
They are 10 items in stock. 2 concurrent process wanted to take 1 item
from stocks. If it is not having ActiveRecord::Base.transaction in
method the result would be 9, but the fact is it is 8 (10-1-1). Look the
tables process below without transaction in console (table 1) & web
browser (table 2):

http://pastie.caboo.se/194711

How come my tests in console and web browser are difference ??

Reinhart
http://teapoci.blogspot.com


      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

Kirim email ke