ruby-on-railsairbrakeerrbit

Unintialized constant Airbrake


I'm trying to catch a specific exception and then log it to errbit manually and then show an error message to the user and redirect them.

With the code below in my model, I can the error

# Causes uninitialized constant Issue::Airbrake

How can I manually log an error to errbit? I'm using the Airbrake gem version 4.0.0

class Issue < ActiveRecord::Base
  after_create :send_email

  def send_email
    begin
    raise StandardError
    rescue StandardError => e
      # Log error in errbit manually
      Airbrake.notify(e)  # Causes uninitialized constant Issue::Airbrake
    end
  end

Solution

  • I had to move the Airbrake gem from the production group in my Gemfile.