instance method
method_missing
Ruby on Rails 6.0.6
Since v6.0.6 Last seen in v6.0.6 PrivateSignature
method_missing(method, *args, &blk)
No documentation comment.
Parameters
-
methodreq -
argsrest -
blkblock
Source
# 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
Defined in activerecord/lib/active_record/database_configurations.rb line 201
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::DatabaseConfigurations