Understanding rails transactions execution.

The database adapter would raise ActiveRecord::StatementInvalid. Your transaction block would rescue the exception, rollback the db transaction, and reraise the exception.

jeremy