method
method_missing
Ruby on Rails latest stable (v7.1.3.2)
-
0 notes -
Class: DatabaseConfigurations
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0
- 3.0.9
- 3.1.0
- 3.2.1
- 3.2.8
- 3.2.13
- 4.0.2
- 4.1.8
- 4.2.1
- 4.2.7
- 4.2.9
- 5.0.0.1
- 5.1.7
- 5.2.3
- 6.0.0 (0)
- 6.1.3.1
- 6.1.7.7
- 7.0.0
- 7.1.3.2
- 7.1.3.4
- What's this?
method_missing(method, *args, &blk)
private
Hide 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