Exception: ActiveRecord::NoDatabaseError
- Inherits:
-
StatementInvalid
- Object
- StandardError
- ActiveRecordError
- AdapterError
- StatementInvalid
- ActiveRecord::NoDatabaseError
- Includes:
- ActiveSupport::ActionableError
- Defined in:
- 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 inherited from StatementInvalid
Constructor Details
#initialize(message = nil, connection_pool: nil) ⇒ NoDatabaseError
Returns a new instance of NoDatabaseError.
314 315 316 |
# File 'lib/active_record/errors.rb', line 314 def initialize( = nil, connection_pool: nil) super( || "Database not found", connection_pool: connection_pool) end |
Class Method Details
.db_error(db_name) ⇒ Object
319 320 321 322 323 324 325 326 327 328 329 330 |
# File 'lib/active_record/errors.rb', line 319 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 file. To resolve this error: - Did you create the database for this app, or delete it? You may need to create your database. - Has the database name changed? Check your database.yml config has the correct database name. To create your database, run:\n\n bin/rails db:create MSG end |