Why is deep_symbolize_keys not available within application.rb (undefined method `deep_symbolize_keys' for Hash)

If there is a better way to do this I am open: I am trying to load a yaml config file which holds application settings (which happens to be shared between the main app and an engine).

class Application < Rails::Application
config_file = “#{Rails.root}/config/config.yml”
if File.exists?(config_file)
::APP_CONFIG = YAML.load_file(config_file)[Rails.env].deep_symbolize_keys
else
puts “No config.yml file found, run ‘rails g blog_engine:install’”
end

end

The file loads if I use #symbolize_keys, but Hash#deep_symbolize_keys is not available at this point. I know I could iterate the hash myself and do this but of course would prefer not to and makes me wonder if there is an alternative way to load such a config file and have the values accessible within environment.rb so that I can assign the value.

Thanks,

David

Ok, so it looks like I need ActiveSupport::CoreExtensions::Hash. A bit confused as at the top of application.rb there is * require ‘rails/all’ *, so I would think this should be included but is not. ActiveSupport is loaded but not CoreExtensions.

ActiveSupport::CoreExtensions::hash::Conversions, ActiveSupport::CoreExtensions::hash::DeepMerge, ActiveSupport::CoreExtensions::hash::Diff, ActiveSupport::CoreExtensions::hash::Except, ActiveSupport::CoreExtensions::hash::IndifferentAccess, ActiveSupport::CoreExtensions::hash::Keys, ActiveSupport::CoreExtensions::hash::ReverseMerge, ActiveSupport::CoreExtensions::hash::Slice

Ok, so it looks like I need ActiveSupport::CoreExtensions::Hash. A bit confused as at the top of application.rb there is * require ‘rails/all’ *, so I would think this should be included but is not. ActiveSupport is loaded but not CoreExtensions.
ActiveSupport::CoreExtensions::hash::Conversions, ActiveSupport::CoreExtensions::hash::DeepMerge, ActiveSupport::CoreExtensions::hash::Diff, ActiveSupport::CoreExtensions::hash::Except, ActiveSupport::CoreExtensions::hash::IndifferentAccess, ActiveSupport::CoreExtensions::hash::Keys, ActiveSupport::CoreExtensions::hash::ReverseMerge, ActiveSupport::CoreExtensions::hash::Slice

Looks like I have answered my own question: if I do my assignments in “config.after_initialize” then I have the CoreExtensions and deep_symbolize_keys.