跳至内容 跳至搜索
方法
A

实例公共方法

action(name, &block)

定义一个可以解决错误的操作。

class PendingMigrationError < MigrationError
  include ActiveSupport::ActionableError

  action "Run pending migrations" do
    ActiveRecord::Tasks::DatabaseTasks.migrate
  end
end
# File activesupport/lib/active_support/actionable_error.rb, line 45
def action(name, &block)
  _actions[name] = block
end