Exception: ActiveRecord::NoDatabaseError
- Inherits:
-
StatementInvalid
- Object
- StandardError
- ActiveRecordError
- AdapterError
- StatementInvalid
- ActiveRecord::NoDatabaseError
- Includes:
- ActiveSupport::ActionableError
- Defined in:
- activerecord/lib/active_record/errors.rb
Overview
Raised when a given database does not exist.
Instance Attribute Summary
Attributes inherited from StatementInvalid
Attributes inherited from AdapterError
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message = nil, connection_pool: nil) ⇒ NoDatabaseError
constructor
A new instance of NoDatabaseError.
Methods included from ActiveSupport::ActionableError
Methods included from ActiveSupport::Concern
#append_features, #class_methods, extended, #included, #prepend_features, #prepended
Methods inherited from StatementInvalid
Constructor Details
#initialize(message = nil, connection_pool: nil) ⇒ NoDatabaseError
Returns a new instance of NoDatabaseError.
335 336 337 |
# File 'activerecord/lib/active_record/errors.rb', line 335 def initialize( = nil, connection_pool: nil) super( || "Database not found", connection_pool: connection_pool) end |
Class Method Details
.db_error(db_name) ⇒ Object
340 341 342 343 344 345 346 347 348 349 350 351 352 |
# File 'activerecord/lib/active_record/errors.rb', line 340 def db_error(db_name) NoDatabaseError.new(" We could not find your database: \#{db_name}. Available database configurations can be found in config/database.yml.\n\n To resolve this error:\n\n - Did you not create the database, or did you delete it? To create the database, run:\n\n bin/rails db:create\n\n - Has the database name changed? Verify that config/database.yml contains the correct database name.\n MSG\nend\n") |