ruby发邮件的问题
class UserNotifier < ActionMailer::Base
@@session = ActionController::Integration::Session.new //////提示这句有问题
///////////////如下
NameError in NewslettersController#sendmails
uninitialized constant ActionController::Integration
RAILS_ROOT: D:/Backup/INSTAN~1/rails_apps/CETC_app/config/..
Application Trace | Framework Trace | Full Trace
D:/Backup/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:263:in `load_missing_constant'
D:/Backup/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:452:in `const_missing'
#{RAILS_ROOT}/app/models/user_notifier.rb:3
#{RAILS_ROOT}/app/controllers/newsletters_controller.rb:61:in `sendmails'
#{RAILS_ROOT}/app/controllers/newsletters_controller.rb:60:in `each'
#{RAILS_ROOT}/app/controllers/newsletters_controller.rb:60:in `sendmails'
D:/Backup/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:263:in `load_missing_constant'
D:/Backup/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:452:in `const_missing'
D:/Backup/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:203:in `load_without_new_constant_marking'
D:/Backup/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:203:in `load_file'
D:/Backup/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in `new_constants_in'
D:/Backup/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:202:in `load_file'
D:/Backup/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:94:in `require_or_load'
D:/Backup/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:248:in `load_missing_constant'
D:/Backup/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:452:in `const_missing'
D:/Backup/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:464:in `const_missing'
D:/Backup/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:470:in `send'
D:/Backup/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:470:in `const_missing'
D:/Backup/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:1095:in `send'
D:/Backup/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:1095:in `perform_action_without_filters'
..............D:/Backup/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/configurator.rb:271:in `run'
D:/Backup/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/configurator.rb:270:in `each'
D:/Backup/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/configurator.rb:270:in `run'
D:/Backup/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/bin/mongrel_rails:127:in `run'
D:/Backup/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/command.rb:211:in `run'
D:/Backup/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/bin/mongrel_rails:243
D:/Backup/INSTAN~1/ruby/bin/mongrel_rails:16:in `load'
D:/Backup/INSTAN~1/ruby/bin/mongrel_rails:16
Request
Parameters: {"_method"=>"put", "id"=>"1"}
Show session dump
---
:user: 1
flash: !map:ActionController::Flash::FlashHash {}
Response
Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"}
[解决办法]
这和发email没有关系噢,是你的Controller中sendmails action中,用到了ActionController::Integration 这个module,但你没有包含进来。默认这个module是包含在ActionController中的,检查你的controller是否有。如果没有,你可以直接引用这个 require 'action_controller/integration'