I am trying to put my emailer password in a .yml file.
Under config/initializers
I have a file emailers_config.rb
require 'yaml'
EMAIL_CONFIG = YAML.load(File.read(Rails.root + "config/mailer_config.yml"))
and in my config/mailer_config.yml
I have:
#production password
smtp_password_pro: foo
#devevopment env password
smtp_password_dev: bar
Now it seems My initializes is not running, because I get this uninitialized constant EMAIL_CONFIG (NameError)
Now Rails is supposed to laod everything under the initializers folder, so loading the file is not an issue.
What is wrong here?
If you are having trouble accessing a constant in your YAML file, try shutting down your local server with control + c
, then run:
$ spring stop
Boot up your server or console again:
$ rails [server | console]
And you might have access to that constant.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With