Bullet

Kill N+1 queries and unused eager loading
Used 37 times
Created by
D Drew Reynolds

Usage

Run this command in your Rails app directory in the terminal:

rails app:template LOCATION="https://railsbytes.com/script/XLEsaW"

Template Source

Review the code before running this template on your machine.

gem_group :development do
  gem 'bullet'
end

run "touch config/initializers/bullet.rb"

inject_into_file 'config/initializers/bullet.rb' do <<~EOF
  if defined? Bullet
    Bullet.enable = true
    Bullet.sentry = true
    Bullet.alert = true
    Bullet.bullet_logger = true
    Bullet.console = true
    Bullet.growl = true
    Bullet.rails_logger = true
    Bullet.honeybadger = true
    Bullet.bugsnag = true
    Bullet.airbrake = true
    Bullet.rollbar = true
    Bullet.add_footer = true
    Bullet.skip_html_injection = false
    Bullet.stacktrace_includes = [ 'your_gem', 'your_middleware' ]
    Bullet.stacktrace_excludes = [ 'their_gem', 'their_middleware', ['my_file.rb', 'my_method'], ['my_file.rb', 16..20] ]
    Bullet.slack = { webhook_url: 'http://some.slack.url', channel: '#default', username: 'notifier' }
  end
  EOF
end
Mark
© 2020 GoRails, LLC