I wanted to preload the configuration (from .yml files). In one of my initializer files (config / initializers / facebook.rb) I have the following line of code:
FACEBOOK_CONFIG = YAML.load_file("#{Rails.root}/config/facebook.yml")[Rails.env]
So, it works like a charm in "DEVELOPMENT" mode. When I switch to production mode, he keeps telling me that FACEBOOK_CONFIG is an uninitialized constant for my file " facebook.js.coffee.erb" located in assets / javascript (if that matters) if I want o "rake assets: precompile". I tried doing random things like: RAILS_ENV=production bundle exec rake assets:precompileor
rake assets: precompile: all
but no luck
I tried to assign the variable " initialize_on_precompile = true" to my production environment (although by default it should be true), just in case.
Why it does not work in production mode (but I want to emphasize that it works (!) In the development environment).
Can anyone help with this?
source
share