Module: ActiveSupport::ActionableError::ClassMethods

Defined in:
lib/active_support/actionable_error.rb

Instance Method Summary collapse

Instance Method Details

#action(name, &block) ⇒ Object

Defines an action that can resolve the error.

class PendingMigrationError < MigrationError
  include ActiveSupport::ActionableError

  action "Run pending migrations" do
    ActiveRecord::Tasks::DatabaseTasks.migrate
  end
end


45
46
47
# File 'lib/active_support/actionable_error.rb', line 45

def action(name, &block)
  _actions[name] = block
end