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.
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):
How come my test in console and web browser are difference ??