Method: ActiveInteractor::Interactor::Callbacks::ClassMethods#after_rollback

Defined in:
lib/active_interactor/interactor/callbacks.rb

#after_rollback(*filters, &block) ⇒ Object

Define a callback to call after #rollback has been called on an interactor instance.

Examples:

class MyInteractor < ActiveInteractor::Base
  after_rollback :print_done

  def perform
    context.fail!
  end

  def rollback
    puts 'Rolling Back'
  end

  private

  def print_done
    puts 'Done'
  end
end

MyInteractor.perform
"Rolling Back"
"Done"
#=> <MyInteractor::Context>

Since:

  • 0.1.0



98
99
100
# File 'lib/active_interactor/interactor/callbacks.rb', line 98

def after_rollback(*filters, &block)
  set_callback(:rollback, :after, *filters, &block)
end