Method: ActiveInteractor::Interactor::Perform#rollback

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

#rollbackObject

This method is abstract.

interactors should override #rollback with the appropriate steps and context mutations required for the interactor to roll back its work.

The steps to run when an interactor fails. An interactor's #rollback method should never be called directly and is instead called by the interactor's context when #fail is called.

Examples:

class MyInteractor < ActiveInteractor::Base
  def perform
    context.first_name = 'Aaron'
    context.fail!
  end

  def rollback
    context.first_name = 'Bob'
  end
end

MyInteractor.perform
#=> <#MyInteractor::Context first_name='Bob'>

Since:

  • 0.1.0



236
# File 'lib/active_interactor/interactor/perform.rb', line 236

def rollback; end