Exception Notification Gem and Rails 3

后端 未结 17 2050
野趣味
野趣味 2021-01-30 05:16

I\'m trying to get this up and running, but I see \"uninitialized constant ExceptionNotifier\" whenever I start my server.

http://github.com/rails/exception_notificatio

17条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-30 05:43

    I had the same problem just now and resolved it this way:

    Gemfile

    source 'http://rubygems.org'
    gem 'exception_notification_rails3', :require => 'exception_notifier'
    

    application.rb

    config.middleware.use ExceptionNotifier,
      :email_prefix => "[some prefix] ",
      :sender_address => %{"Notifier" },
      :exception_recipients => %w{recipient@domain.com}
    

    I'm refactoring a Rails 2.3 project to 3.0, so I haven't tried this on a fresh install.

    Edit:

    It might actually be better (or "more correct") to put the ExceptionNotifier initialization in a separate initializer file in config/initializers/ instead of application.rb.

    config/initializers/exception_notifier.rb

    MyApp::Application.config.middleware.use ExceptionNotifier,
      :email_prefix => "[some prefix] ",
      :sender_address => %{"Notifier" },
      :exception_recipients => %w{recipient@domain.com}
    

提交回复
热议问题