Thursday, August 21, 2014

How to install Exception Notification gem in Rails 4.1

1. Add the gem to Gemfile:

gem 'exception_notification'



bundle install

2. In config/environments/production.rb:

Whatever::Application.config.middleware.use ExceptionNotification::Rack,
  :email => {
    :email_prefix => "[Whatever] ",
    :sender_address => %{"notifier" },
    :exception_recipients => %w{exceptions@example.com}
  }

3. Configure ActionMailer, in config/environments/production.rb:

I am using Sendgrid SMTP API so:

config.action_mailer.delivery_method = :smtp

If you have sendmail installed on the production server:

config.action_mailer.delivery_method = :sendmail

4. In production.rb:
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true