bullet: Uninitialized constant Bullet

Hi, I am working on Rails 4.0.0 and Ruby 2.1.2-p95, in my development section of Gemfile I added gem 'bullet'

And in the config/environments/development.rb I had the following code:

config.after_initialize do
  Bullet.enable = true
  Bullet.alert = true
  Bullet.bullet_logger = true
  Bullet.console = true
  Bullet.rails_looger = true
end

I restart my server and I get Uninitialized constant Bullet and my development server crashes. Can you please help me with this issue?

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 2
  • Comments: 21 (6 by maintainers)

Most upvoted comments

same problem to use Bullet with Rspec…

was solved moving

  if Bullet.enable?
    config.before(:each) do
      Bullet.start_request
    end

    config.after(:each) do
      Bullet.perform_out_of_channel_notifications if Bullet.notification?
      Bullet.end_request
    end
  end

to rspec/rails_helper.rb, inside RSpec.configure block

@RafaelPrallon’s solution worked for me - loading from rails_helper.rb still results in an error without it.

same here.

Update: The bullet gem was setting to development in my Gemfile, but not to test.

I had this issue and to solve it i’ve followed the solution indicated here: https://stackoverflow.com/a/50813770/8479614

@RafaelPrallon’s solution worked for me - loading from rails_helper.rb still results in an error without it.

ok, I updated README to put code to rails_helper.rb

Problem

I encountered the same problem when deploy with capistrano 3.5.0

Then I check bundle list | grep bullet and found it was not installed.

Then I was wondering wether capistano bundle does not install development group gems and I found this.

https://github.com/capistrano/bundler screen shot 2016-06-24 at 17 02 52

Solution

So what I need to do is make sure capistrano install gems in development group.

set :bundle_without, [:test]

Just for people who may have the same problem as me!