Exception: ActiveRecord::NoDatabaseError
- Inherits:
-
StatementInvalid
- Object
- StandardError
- ActiveRecordError
- 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
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message = 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) ⇒ NoDatabaseError
Returns a new instance of NoDatabaseError.
291 292 293 |
# File 'activerecord/lib/active_record/errors.rb', line 291 def initialize( = nil) super( || "Database not found") end |
Class Method Details
.db_error(db_name) ⇒ Object
296 297 298 299 300 301 302 303 304 305 306 307 |
# File 'activerecord/lib/active_record/errors.rb', line 296 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 |