跳至内容 跳至搜索

当给定的数据库不存在时引发。

方法
D
N
包含的模块

类公共方法

db_error(db_name)

# File activerecord/lib/active_record/errors.rb, line 340
      def db_error(db_name)
        NoDatabaseError.new(<<~MSG)
          We could not find your database: #{db_name}. Available database configurations can be found in config/database.yml.

          To resolve this error:

          - Did you not create the database, or did you delete it? To create the database, run:

              bin/rails db:create

          - Has the database name changed? Verify that config/database.yml contains the correct database name.
        MSG
      end

new(message = nil, connection_pool: nil)

# File activerecord/lib/active_record/errors.rb, line 335
def initialize(message = nil, connection_pool: nil)
  super(message || "Database not found", connection_pool: connection_pool)
end