Rails中的事务
?
T2.transaction do t1 = T1.new t1.save! t2 = T2.new t2.save! end
?当按上面的方式设置事务,则生成的语句将是
begin
? begin
? insert into t1....
? commit
? insert into t2...
commit
?
T2.transaction do T1.transaction do t1 = T1.new t1.save! t2 = T2.new t2.save endend
?而按上面的方式设置事务,则生成的语句将是
begin
? insert into t1....
? insert into t2...
commit
?
?
?
?