In config/data.yml
, I have:
development:
something: some_value
production:
something: different_value
in config/initializers/constants.rb
, I load it:
CONST_DATA = YAML.load_file("#{::Rails.root}/config/data.yml")[::Rails.env]
and then I want to use this CONST_DATA
in the /config/environments/production.rb
file, but when I do that, I get an error saying
ERROR -- : uninitialized constant CONST_DATA (NameError)
How to make this constant accessible in the /config/environments/production.rb
file?
Thank you