2011-01-08 73 views
0

我想禁用我沒有在我的應用程序中使用的部分鋼軌,如ActionMailer。 Ib我application.rb,我做了以下更改是否有可能在Rails 3 application.rb中「卸載」ActionMailer?

require "action_controller/railtie" 
require "action_mailer/railtie" 
#require 'rails/all' 

而且我的應用程序工作正常。現在,當我去註釋'require'action_mailer/railtie''行時,出現以下錯誤。我沒有安裝任何郵件程序,那麼發生了什麼?

感謝

=> Booting WEBrick 
=> Rails 3.0.3 application starting in development on http://0.0.0.0:3000 
=> Call with -d to detach 
=> Ctrl-C to shutdown server 
Exiting 
/home/test/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/railtie/configuration.rb:77:in `method_missing': undefined method `action_mailer' for #<Rails::Application::Configuration:0x00000002c337f8> (NoMethodError) 
     from /home/test/shipped/deluxe/deluxe/config/environments/development.rb:18:in `block in <top (required)>' 
     from /home/test/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/application.rb:47:in `class_eval' 
     from /home/test/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/application.rb:47:in `configure' 
     from /home/test/shipped/deluxe/deluxe/config/environments/development.rb:1:in `<top (required)>' 
     from /home/test/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require' 
     from /home/test/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `block in require' 
     from /home/test/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `block in load_dependency' 
     from /home/test/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in `new_constants_in' 
     from /home/test/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency' 
     from /home/test/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require' 
     from /home/test/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/application/bootstrap.rb:11:in `block in <module:Bootstrap>' 
     from /home/test/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `instance_exec' 
     from /home/test/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `run' 
     from /home/test/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/initializable.rb:50:in `block in run_initializers' 
     from /home/test/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `each' 
     from /home/test/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `run_initializers' 
     from /home/test/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/application.rb:134:in `initialize!' 
     from /home/test/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/application.rb:77:in `method_missing' 
     from /home/test/shipped/deluxe/deluxe/config/environment.rb:6:in `<top (required)>' 
     from /home/test/shipped/deluxe/deluxe/config.ru:3:in `require' 
     from /home/test/shipped/deluxe/deluxe/config.ru:3:in `block in <main>' 
     from /home/test/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval' 
     from /home/test/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize' 
     from /home/test/shipped/deluxe/deluxe/config.ru:1:in `new' 
     from /home/test/shipped/deluxe/deluxe/config.ru:1:in `<main>' 
     from /home/test/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/builder.rb:35:in `eval' 
     from /home/test/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/builder.rb:35:in `parse_file' 
     from /home/test/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/server.rb:162:in `app' 
     from /home/test/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/server.rb:248:in `wrapped_app' 
     from /home/test/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/server.rb:213:in `start' 
     from /home/test/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/commands/server.rb:65:in `start' 
     from /home/test/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/commands.rb:30:in `block in <top (required)>' 
     from /home/test/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/commands.rb:27:in `tap' 
     from /home/test/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/commands.rb:27:in `<top (required)>' 
     from script/rails:6:in `require' 
     from script/rails:6:in `<main>' 

回答

1

在application.rb中

config.frameworks -= [:action_mailer] 
6

小心,config.frameworks被棄用的Rails 3!

你有錯誤,從第18行的文件development.rb的未來:

config.action_mailer.raise_delivery_errors = false 

既然你不需要它了,config.action_mailer是不確定的。你只需要評論這一行,你會沒事的。