HEX
Server: Apache
System: Linux s198.coreserver.jp 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: nagasaki (10062)
PHP: 7.1.33
Disabled: NONE
Upload Files
File: //usr/local/rvm/gems/ruby-2.7.4/doc/activerecord-6.1.4.1/ri/ActiveRecord/Rollback/cdesc-Rollback.ri
U:RDoc::NormalClass[iI"
Rollback:ETI"ActiveRecord::Rollback;TI"$ActiveRecord::ActiveRecordError;To:RDoc::Markup::Document:@parts[o;;[
o:RDoc::Markup::Paragraph;[I"W{ActiveRecord::Base.transaction}[rdoc-ref:Transactions::ClassMethods#transaction] ;TI"auses this exception to distinguish a deliberate rollback from other exceptional situations. ;TI"3Normally, raising an exception will cause the ;TI"X{.transaction}[rdoc-ref:Transactions::ClassMethods#transaction] method to rollback ;TI"Othe database transaction *and* pass on the exception. But if you raise an ;TI"ZActiveRecord::Rollback exception, then the database transaction will be rolled back, ;TI"&without passing on the exception.;To:RDoc::Markup::BlankLineo;	;[I"QFor example, you could do this in your controller to rollback a transaction:;T@o:RDoc::Markup::Verbatim;[I"4class BooksController < ActionController::Base
;TI"  def create
;TI"    Book.transaction do
;TI"*      book = Book.new(params[:book])
;TI"      book.save!
;TI"      if today_is_friday?
;TI"M        # The system must fail on Friday so that our support department
;TI"J        # won't be out of job. We silently rollback this transaction
;TI")        # without telling the user.
;TI"@        raise ActiveRecord::Rollback, "Call tech support!"
;TI"      end
;TI"
    end
;TI"P    # ActiveRecord::Rollback is the only exception that won't be passed on
;TI"Q    # by ActiveRecord::Base.transaction, so this line will still be reached
;TI"    # even on Friday.
;TI"    redirect_to root_url
;TI"  end
;TI"end;T:@format0:
@fileI" lib/active_record/errors.rb;T:0@omit_headings_from_table_of_contents_below0;
0;0[[[[[I"
class;T[[:public[[:protected[[:private[[I"
instance;T[[;[[;[[;[[[U:RDoc::Context::Section[i0o;;[;
0;0[@/I"ActiveRecord;TcRDoc::NormalModule