fail rollback transaction with manual raise exception

With :   PostgreSQL 8.4 or postgresql-8.3   rails 2.3.4   pg 9.x or pg 8.x

I test this code:

save! just throws an error if there is an issue. Do you have validations that are supposed to cause an exception in that case?

Actually you need to put that in an exception block. You are saving the data before the raise.

According to the ActiveRecord documentation, any exception thrown inside a transaction block must rollback all updates have been made within the transaction. => "Normally, raising an exception will cause the transaction method to rollback the database transaction and pass on the exception"

Did you try 'raise ActiveRecord::Rollback' ?

without the .new

Yes I tried 'raise ActiveRecord::Rollback' without '.new', but i have the same problem.

what does the corresponding log file look like ?


I'm sorry. The problem was the following code that another developer had added:

class ApplicationController < ActionController::Base   prepend_around_filter :action_transaction

  def action_transaction     ActiveRecord::Base.transaction do       yield     end   end


thanks anyway