我有文件config/ initializers/secrets.rb。 载有以下内容:
Rails.configuration.smtp_domain = "derp.com"
Rails.configuration.smtp_password = "derpderp"
Rails.configuration.smtp_user = "[email protected]"
Rails.configuration.smtp_address = "derp.derp.com"
In my config/environments/development.rb I have the following:
config.action_mailer.smtp_settings = {
:address => Rails.configuration.smtp_address,
:port => 587,
:domain => Rails.configuration.smtp_domain,
:user_name => Rails.configuration.smtp_user,
:password => Rails.configuration.smtp_password,
:authentication => login ,
:enable_starttls_auto => true
}
现在,Ibundle exec rails c
我发现这一错误:
`method_missing : undefined method `smtp_address for #<Rails::Application::Configuration:0x007f8c4505b238> (NoMethodError)
However If I comment the smtp config out, then in the console I can do this:
Loading development environment (Rails 3.2.1)
irb(main):001:0> Rails.configuration.smtp_address
=> "derp.derp.com"
在生产中,我可以这样说,尽管! 任何帮助都会受到高度赞赏。