$ script/plugin install git://github.com/rails/exception_notification.git
$ ls vendor/plugins/
exception_notification
$ cat vendor/plugins/exception_notification/init.rb
require "action_mailer"
require "exception_notifier"
require "exception_notifiable"
require "exception_notifier_helper"
$ script/console
Loading development environment (Rails 2.3.2)
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support \
/dependencies.rb:443:in `load_missing_constant':NameError: \
uninitialized constant ExceptionNotifier
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support \
/dependencies.rb:443:in `load_missing_constant':NameError: \
uninitialized constant ApplicationController
>> require "exception_notifier"
MissingSourceFile: no such file to load -- exception_notifier
可能很明显,但我今天很累。
答案 0 :(得分:2)
这篇博文有解决方案: How to Install the Exception Notifier Plugin with Ruby on Rails
environment.rb文件中的ExceptionNotifier.exception_recipients = %w(user@domain)
语句可能位于Rails::Initializer.run do |config|
块内。
如果是这种情况,在块结束后放置它将解决问题。
答案 1 :(得分:2)
对于2.3-stable,您需要以下内容:
使用ExceptionNotification::Notifier
而非ExceptionNotifier
。
不要忘记在控制器中添加包含ExceptionNotification::Notifiable
。
答案 2 :(得分:1)
您应该从特定分支安装此插件:
script/plugin install git://github.com/rails/exception_notification.git -r "2-3-stable"
和configure it exactly as docs are saying。
或使用Rails模板(在您的模板中):
plugin 'exception_notifier', :git => 'git://github.com/rails/exception_notification.git', :branch => '2-3-stable'
答案 3 :(得分:0)
在environment.rb中,在initialize方法之后添加:
require 'exception_notification'