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:.
-
#name ⇒ Object
readonly
:nodoc:.
Instance Method Summary collapse
- #_database=(database) ⇒ Object
- #adapter ⇒ Object
- #adapter_class ⇒ Object
- #checkout_timeout ⇒ Object
- #database ⇒ Object
- #for_current_env? ⇒ Boolean
- #host ⇒ Object
- #idle_timeout ⇒ Object
-
#initialize(env_name, name) ⇒ DatabaseConfig
constructor
A new instance of DatabaseConfig.
-
#inspect ⇒ Object
:nodoc:.
- #max_queue ⇒ Object
- #max_threads ⇒ Object
- #migrations_paths ⇒ Object
- #min_threads ⇒ Object
- #new_connection ⇒ Object
- #pool ⇒ Object
- #query_cache ⇒ Object
- #reaping_frequency ⇒ Object
- #replica? ⇒ Boolean
- #schema_cache_path ⇒ Object
- #use_metadata_table? ⇒ Boolean
- #validate! ⇒ Object
Constructor Details
#initialize(env_name, name) ⇒ DatabaseConfig
Returns a new instance of DatabaseConfig.
11 12 13 14 15 |
# File 'lib/active_record/database_configurations/database_config.rb', line 11 def initialize(env_name, name) @env_name = env_name @name = name @adapter_class = nil 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 |
#name ⇒ Object (readonly)
:nodoc:
9 10 11 |
# File 'lib/active_record/database_configurations/database_config.rb', line 9 def name @name end |
Instance Method Details
#_database=(database) ⇒ Object
43 44 45 |
# File 'lib/active_record/database_configurations/database_config.rb', line 43 def _database=(database) raise NotImplementedError end |
#adapter ⇒ Object
47 48 49 |
# File 'lib/active_record/database_configurations/database_config.rb', line 47 def adapter raise NotImplementedError end |
#adapter_class ⇒ Object
17 18 19 |
# File 'lib/active_record/database_configurations/database_config.rb', line 17 def adapter_class @adapter_class ||= ActiveRecord::ConnectionAdapters.resolve(adapter) end |
#checkout_timeout ⇒ Object
71 72 73 |
# File 'lib/active_record/database_configurations/database_config.rb', line 71 def checkout_timeout raise NotImplementedError end |
#database ⇒ Object
39 40 41 |
# File 'lib/active_record/database_configurations/database_config.rb', line 39 def database raise NotImplementedError end |
#for_current_env? ⇒ Boolean
91 92 93 |
# File 'lib/active_record/database_configurations/database_config.rb', line 91 def for_current_env? env_name == ActiveRecord::ConnectionHandling::DEFAULT_ENV.call end |
#host ⇒ Object
35 36 37 |
# File 'lib/active_record/database_configurations/database_config.rb', line 35 def host raise NotImplementedError end |
#idle_timeout ⇒ Object
79 80 81 |
# File 'lib/active_record/database_configurations/database_config.rb', line 79 def idle_timeout raise NotImplementedError end |
#inspect ⇒ Object
:nodoc:
21 22 23 |
# File 'lib/active_record/database_configurations/database_config.rb', line 21 def inspect # :nodoc: "#<#{self.class.name} env_name=#{@env_name} name=#{@name} adapter_class=#{adapter_class}>" end |
#max_queue ⇒ Object
63 64 65 |
# File 'lib/active_record/database_configurations/database_config.rb', line 63 def max_queue raise NotImplementedError end |
#max_threads ⇒ Object
59 60 61 |
# File 'lib/active_record/database_configurations/database_config.rb', line 59 def max_threads raise NotImplementedError end |
#migrations_paths ⇒ Object
87 88 89 |
# File 'lib/active_record/database_configurations/database_config.rb', line 87 def migrations_paths raise NotImplementedError end |
#min_threads ⇒ Object
55 56 57 |
# File 'lib/active_record/database_configurations/database_config.rb', line 55 def min_threads raise NotImplementedError end |
#new_connection ⇒ Object
25 26 27 |
# File 'lib/active_record/database_configurations/database_config.rb', line 25 def new_connection adapter_class.new(configuration_hash) end |
#pool ⇒ Object
51 52 53 |
# File 'lib/active_record/database_configurations/database_config.rb', line 51 def pool raise NotImplementedError end |
#query_cache ⇒ Object
67 68 69 |
# File 'lib/active_record/database_configurations/database_config.rb', line 67 def query_cache raise NotImplementedError end |
#reaping_frequency ⇒ Object
75 76 77 |
# File 'lib/active_record/database_configurations/database_config.rb', line 75 def reaping_frequency raise NotImplementedError end |
#replica? ⇒ Boolean
83 84 85 |
# File 'lib/active_record/database_configurations/database_config.rb', line 83 def replica? raise NotImplementedError end |
#schema_cache_path ⇒ Object
95 96 97 |
# File 'lib/active_record/database_configurations/database_config.rb', line 95 def schema_cache_path raise NotImplementedError end |
#use_metadata_table? ⇒ Boolean
99 100 101 |
# File 'lib/active_record/database_configurations/database_config.rb', line 99 def raise NotImplementedError end |
#validate! ⇒ Object
29 30 31 32 33 |
# File 'lib/active_record/database_configurations/database_config.rb', line 29 def validate! adapter_class if adapter true end |