method

build_configs

Importance_0
v6.0.0 - Show latest stable - 0 notes - Class: DatabaseConfigurations
build_configs(configs) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/database_configurations.rb, line 118
      def build_configs(configs)
        return configs.configurations if configs.is_a?(DatabaseConfigurations)
        return configs if configs.is_a?(Array)

        db_configs = configs.flat_map do |env_name, config|
          if config.is_a?(Hash) && config.all? { |_, v| v.is_a?(Hash) }
            walk_configs(env_name.to_s, config)
          else
            build_db_config_from_raw_config(env_name.to_s, "primary", config)
          end
        end

        current_env = ActiveRecord::ConnectionHandling::DEFAULT_ENV.call.to_s

        unless db_configs.find(&:for_current_env?)
          db_configs << environment_url_config(current_env, "primary", {})
        end

        merge_db_environment_variables(current_env, db_configs.compact)
      end
Register or log in to add new notes.