简体   繁体   中英

Rails not finding exception notifier plugin

$ 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

Probably obvious, but I'm tired today.

This blog post has the solution: How to Install the Exception Notifier Plugin with Ruby on Rails

The ExceptionNotifier.exception_recipients = %w(user@domain) statement in your environment.rb file is probably inside the Rails::Initializer.run do |config| block.

If this is the case, placing it after the end of the block will solve the problem.

For 2.3-stable, you need the following:

Use ExceptionNotification::Notifier and not ExceptionNotifier .

And don't forget to add include ExceptionNotification::Notifiable in your controllers.

You should install this plugin from specific branch:

script/plugin install git://github.com/rails/exception_notification.git -r "2-3-stable"

and configure it exactly as docs are saying .

or when using Rails Templates (in Your template):

plugin 'exception_notifier', :git => 'git://github.com/rails/exception_notification.git', :branch => '2-3-stable'

在environment.rb中,在initialize方法之后添加:

require 'exception_notification'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM