123456789_123456789_123456789_123456789_123456789_

Exception: ActiveRecord::NoDatabaseError

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: ActiveRecord::StatementInvalid
Defined in: activerecord/lib/active_record/errors.rb

Overview

Raised when a given database does not exist.

::ActiveSupport::ActionableError - Attributes & Methods

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(message = nil, connection_pool: nil) ⇒ NoDatabaseError

[ GitHub ]

  
# File 'activerecord/lib/active_record/errors.rb', line 314

def initialize(message = nil, connection_pool: nil)
  super(message || "Database not found", connection_pool: connection_pool)
end

Class Attribute Details

._actions (rw)

[ GitHub ]

  
# File 'activesupport/lib/active_support/actionable_error.rb', line 17

class_attribute :_actions, default: {}

._actions?Boolean (rw)

[ GitHub ]

  
# File 'activesupport/lib/active_support/actionable_error.rb', line 17

class_attribute :_actions, default: {}

Class Method Details

.db_error(db_name)

[ GitHub ]

  
# File 'activerecord/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.

    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

Instance Attribute Details

#_actions (rw)

[ GitHub ]

  
# File 'activesupport/lib/active_support/actionable_error.rb', line 17

class_attribute :_actions, default: {}

#_actions?Boolean (rw)

[ GitHub ]

  
# File 'activesupport/lib/active_support/actionable_error.rb', line 17

class_attribute :_actions, default: {}