method
method_missing
rails latest stable - Class:
ActiveRecord::DatabaseConfigurations
method_missing(method, *args, &blk)private
No documentation available.
# File activerecord/lib/active_record/database_configurations.rb, line 201
def method_missing(method, *args, &blk)
case method
when :fetch
throw_getter_deprecation(method)
configs_for(env_name: args.first)
when :values
throw_getter_deprecation(method)
configurations.map(&:config)
when :[]=
throw_setter_deprecation(method)
env_name = args[0]
config = args[1]
remaining_configs = configurations.reject { |db_config| db_config.env_name == env_name }
new_config = build_configs(env_name => config)
new_configs = remaining_configs + new_config
ActiveRecord::Base.configurations = new_configs
else
raise NotImplementedError, "`ActiveRecord::Base.configurations` in Rails 6 now returns an object instead of a hash. The `#{method}` method is not supported. Please use `configs_for` or consult the documentation for supported methods."
end
end