Class: ActiveRecord::DatabaseConfigurations::DatabaseConfig
- Inherits:
-
Object
- Object
- ActiveRecord::DatabaseConfigurations::DatabaseConfig
- Defined in:
- lib/active_record/database_configurations/database_config.rb
Overview
ActiveRecord::Base.configurations will return either a HashConfig or UrlConfig respectively. It will never return a DatabaseConfig object, as this is the parent class for the types of database configuration objects.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#env_name ⇒ Object
readonly
:nodoc:.
-
#spec_name ⇒ Object
readonly
:nodoc:.
Instance Method Summary collapse
- #for_current_env? ⇒ Boolean
-
#initialize(env_name, spec_name) ⇒ DatabaseConfig
constructor
A new instance of DatabaseConfig.
- #migrations_paths ⇒ Object
- #replica? ⇒ Boolean
- #to_legacy_hash ⇒ Object
- #url_config? ⇒ Boolean
Constructor Details
#initialize(env_name, spec_name) ⇒ DatabaseConfig
Returns a new instance of DatabaseConfig.
11 12 13 14 |
# File 'lib/active_record/database_configurations/database_config.rb', line 11 def initialize(env_name, spec_name) @env_name = env_name @spec_name = spec_name end |
Instance Attribute Details
#env_name ⇒ Object (readonly)
:nodoc:
9 10 11 |
# File 'lib/active_record/database_configurations/database_config.rb', line 9 def env_name @env_name end |
#spec_name ⇒ Object (readonly)
:nodoc:
9 10 11 |
# File 'lib/active_record/database_configurations/database_config.rb', line 9 def spec_name @spec_name end |
Instance Method Details
#for_current_env? ⇒ Boolean
32 33 34 |
# File 'lib/active_record/database_configurations/database_config.rb', line 32 def for_current_env? env_name == ActiveRecord::ConnectionHandling::DEFAULT_ENV.call end |
#migrations_paths ⇒ Object
20 21 22 |
# File 'lib/active_record/database_configurations/database_config.rb', line 20 def migrations_paths raise NotImplementedError end |
#replica? ⇒ Boolean
16 17 18 |
# File 'lib/active_record/database_configurations/database_config.rb', line 16 def replica? raise NotImplementedError end |
#to_legacy_hash ⇒ Object
28 29 30 |
# File 'lib/active_record/database_configurations/database_config.rb', line 28 def to_legacy_hash { env_name => config } end |
#url_config? ⇒ Boolean
24 25 26 |
# File 'lib/active_record/database_configurations/database_config.rb', line 24 def url_config? false end |