Method: ActiveRecord::DatabaseConfigurations#find_db_config
- Defined in:
- activerecord/lib/active_record/database_configurations.rb
#find_db_config(env) ⇒ Object
Returns a single DatabaseConfig object based on the requested environment.
If the application has multiple databases find_db_config
will return the first DatabaseConfig for the environment.
121 122 123 124 125 126 127 128 |
# File 'activerecord/lib/active_record/database_configurations.rb', line 121 def find_db_config(env) env = env.to_s configurations.find do |db_config| db_config.for_current_env? && (db_config.env_name == env || db_config.name == env) end || configurations.find do |db_config| db_config.env_name == env end end |