在我们的 rails 应用程序中,我们希望在启动期间加载邮件服务器配置。这是我们在 config/environment/development.rb 中的内容:
#Action Mailer
config.action_mailer.smtp_settings = eval(Authentify::AuthentifyUtility.find_config_const('development_smtp_setting'))
Authentify::AuthentifyUtility.find_config_const('development_smtp_setting')
应返回:
{
:address => "mymail.com",
:port => 587,
:user_name => "smtp_login_name",
:password => "password",
:authentication => :plain,
:enable_starttls_auto => false
}
但是rails server
抛出错误:
activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
: ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished)
在加载期间似乎没有数据库连接。加载邮件服务器配置的正确方法是什么?谢谢。