diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a654c89..374a2102 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ ### Changes * Upgraded dry-validation dependency to dry-schema 1.0 ([#224](https://github.com/railsconfig/config/pull/224)) +* Moved constant to be defined on `Object` instead of `Kernel` ([#227](https://github.com/railsconfig/config/issues/227)) ## 1.7.2 diff --git a/lib/config.rb b/lib/config.rb index 9365d27d..11c43d91 100644 --- a/lib/config.rb +++ b/lib/config.rb @@ -53,8 +53,9 @@ def self.load_files(*files) # Loads and sets the settings constant! def self.load_and_set_settings(*files) - Kernel.send(:remove_const, Config.const_name) if Kernel.const_defined?(Config.const_name) - Kernel.const_set(Config.const_name, Config.load_files(files)) + name = Config.const_name + Object.send(:remove_const, name) if Object.const_defined?(name) + Object.const_set(name, Config.load_files(files)) end def self.setting_files(config_root, env) @@ -70,7 +71,7 @@ def self.setting_files(config_root, env) end def self.reload! - Kernel.const_get(Config.const_name).reload! + Object.const_get(Config.const_name).reload! end end