2011-01-08 3 views
0

Я пытаюсь отключить части рельсов, которые я не использую в своем приложении, например ActionMailer. Ib мое application.rb, я внесла следующее изменениеМожно ли «выгрузить» ActionMailer в Rails 3 application.rb?

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>' 

ответ

6

Будьте осторожны, config.frameworks осуждается в Rails 3!

Ошибка у вас приходит от # 18 строку файла development.rb:

config.action_mailer.raise_delivery_errors = false 

Поскольку вы не требуют больше, config.action_mailer не определено. Вам просто нужно прокомментировать линию, и с вами все будет в порядке.

Смежные вопросы