Class: ActiveRecord::DatabaseConfigurations::DatabaseConfig

Inherits:
Object
  • Object
show all
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

HashConfig, UrlConfig

Instance Attribute Summary collapse

Instance Method Summary collapse

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_nameObject (readonly)

:nodoc:



9
10
11
# File 'lib/active_record/database_configurations/database_config.rb', line 9

def env_name
  @env_name
end

#spec_nameObject (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

Returns:

  • (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_pathsObject

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/active_record/database_configurations/database_config.rb', line 20

def migrations_paths
  raise NotImplementedError
end

#replica?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


16
17
18
# File 'lib/active_record/database_configurations/database_config.rb', line 16

def replica?
  raise NotImplementedError
end

#to_legacy_hashObject



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

Returns:

  • (Boolean)


24
25
26
# File 'lib/active_record/database_configurations/database_config.rb', line 24

def url_config?
  false
end