Dar*_*rer 41 exception-handling ruby-on-rails ruby-on-rails-plugins ruby-on-rails-3
我正在尝试启动并运行,但每当我启动服务器时,我都会看到"未初始化的常量ExceptionNotifier".
http://github.com/rails/exception_notification
在我的Gemfile中我有
gem"exception_notification",:git =>" http://github.com/rails/exception_notification.git " ,: branch =>"master"
我已经尝试将配置如config/application.rb,config/environment.rb和config.ru中的github readme所示.我用我的应用程序名称替换了"Whatever".
Jan*_*n M 57
之前的所有答案都已过时,您现在只需将其添加到您的gemfile:
gem 'exception_notification', :require => 'exception_notifier'
Run Code Online (Sandbox Code Playgroud)
并按照自述文件中的说明编辑您的production.rb配置文件:
config.middleware.use ExceptionNotifier,
:email_prefix => "[Exception] ",
:sender_address => %{"Exception Notifier" <support@example.com>},
:exception_recipients => %w{you@me.com}
Run Code Online (Sandbox Code Playgroud)
小智 21
官方gem的最新版本与Rails 3一起使用,你可以在这里找到它:https://github.com/smartinez87/exception_notification.
下一个gem发布将使该:require => 'exception_notifier'选项不必要.
Bvu*_*Ic7 13
好吧,它现在为我工作:
# Gemfile
gem "exception_notification", :git => "git://github.com/rails/exception_notification", :require => 'exception_notifier'
# application.rb, inside the config block
config.middleware.use ::ExceptionNotifier,
:email_prefix => "ApplicationName-Errors: ",
:sender_address => %w{office@application.com},
:exception_recipients => %w{office@application.com}
Run Code Online (Sandbox Code Playgroud)
Saq*_* R. 10
保持简单傻
在 gemfile中
gem 'exception_notification', :require => 'exception_notifier'
Run Code Online (Sandbox Code Playgroud)
在application.rb文件中
config.middleware.use ExceptionNotifier,
:email_prefix => "[ERROR] ",
:sender_address => %{"Exception Notifier" <Dummy_email@exapmle.com>},
:exception_recipients => %w{Dummy_email@example.com}
Run Code Online (Sandbox Code Playgroud)
你完成了......:*
Rails 3 似乎不能以 gem 形式使用这个插件。也许机架应用程序无法从 gems 加载?我将其作为插件安装,并将配置语法更改为:
config.middleware.use "::ExceptionNotifier"
代替
config.middleware.use ExceptionNotifier