I updated my rails from 2.0.2 to 2.3.4 yesterday. Then I found something
strange. I write transaction use ActiveRecord::Base.transaction block
like below:
def action_name
begin
ActiveRecord::Base.transaction do
object1.destroy
object2.save!
end
render :json => {:success => true}.to_json,:layout=>false
rescue Exception => exc
render :json => {:success =>
false,:errors=>exc.message}.to_json,:layout=>false
end
end
It works better at 2.0.2, but the transaction did no work at 2.3.4. If
the object2.save! faile and raise exception, the transaction did not
rollback.
Is there some setting or config I must edit?