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


43
44
45
# File 'lib/active_support/actionable_error.rb', line 43

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