读书人

Rails中的事宜

发布时间: 2012-12-21 12:03:50 作者: rapoo

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

?

?

?

?

读书人网 >网络基础

热点推荐