1

当我在开发模式下运行我的 rails 应用程序时,它运行良好。但是,当我在生产模式下运行它时,它会在启动时崩溃,我从服务器获得以下输出:

/Users/user/.rvm/gems/ruby-1.9.3-p0/gems/actionmailer-3.2.3/lib/action_mailer/base.rb:437:in `method_missing': undefined method `default_url_setting=' for ActionMailer::Base:Class (NoMethodError)
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/actionmailer-3.2.3/lib/action_mailer/railtie.rb:34:in `block (3 levels) in <class:Railtie>'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/actionmailer-3.2.3/lib/action_mailer/railtie.rb:34:in `each'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/actionmailer-3.2.3/lib/action_mailer/railtie.rb:34:in `block (2 levels) in <class:Railtie>'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.3/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.3/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.3/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.3/lib/active_support/lazy_load_hooks.rb:42:in `each'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.3/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/actionmailer-3.2.3/lib/action_mailer/base.rb:733:in `<class:Base>'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/actionmailer-3.2.3/lib/action_mailer/base.rb:325:in `<module:ActionMailer>'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/actionmailer-3.2.3/lib/action_mailer/base.rb:10:in `<top (required)>'
from /Users/user/Desktop/MetaRepo/MetaWebsite/app/mailers/notification_mailer.rb:1:in `<top (required)>'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:359:in `require_or_load'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:313:in `depend_on'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:225:in `require_dependency'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/engine.rb:439:in `block (2 levels) in eager_load!'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/engine.rb:438:in `each'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/engine.rb:438:in `block in eager_load!'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/engine.rb:436:in `each'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/engine.rb:436:in `eager_load!'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/application/finisher.rb:53:in `block in <module:Finisher>'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `run'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `each'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/application.rb:136:in `initialize!'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/user/Desktop/MetaRepo/MetaWebsite/config/environment.rb:5:in `<top (required)>'
from /Users/user/Desktop/MetaRepo/MetaWebsite/config.ru:4:in `require'
from /Users/user/Desktop/MetaRepo/MetaWebsite/config.ru:4:in `block in <main>'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
from /Users/user/Desktop/MetaRepo/MetaWebsite/config.ru:1:in `new'
from /Users/user/Desktop/MetaRepo/MetaWebsite/config.ru:1:in `<main>'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/builder.rb:40:in `eval'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/builder.rb:40:in `parse_file'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/server.rb:200:in `app'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/commands/server.rb:46:in `app'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/server.rb:301:in `wrapped_app'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/server.rb:252:in `start'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/commands/server.rb:70:in `start'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/commands.rb:55:in `block in <top (required)>'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/commands.rb:50:in `tap'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

显然它与我的 ActionMailer gem 有关,但我完全被难住了。任何帮助深表感谢!

4

1 回答 1

3

文档(ctrl+F "default_url") 上,有default_url_options. 也许你拼错了方法?

 config.action_mailer.default_url_options = { :host => "example.com" }
于 2012-12-26T04:31:33.647 回答