2

I've added to my Gemfile bullet gem:

gem "bullet", :group => "development"

and in my development.rb I added:

  config.after_initialize do
    Bullet.enable = true
    Bullet.alert = true
  end

When I try to run my rails server I have the following error message:

/home/mateusz/.rvm/gems/ruby-2.0.0-p0@rails4/gems/bullet-4.7.1/lib/bullet/active_record4.rb:53:in `alias_method': undefined method `construct_association' for class `ActiveRecord::Associations::JoinDependency' (NameError)

Thanks in advance for help.

Bongs
  • 5,502
  • 4
  • 30
  • 50
Mateusz Urbański
  • 7,352
  • 15
  • 68
  • 133

1 Answers1

4

hmmm.. works fine by me. Tried on a pre-existing and a new project - Win & Lin, both. There must be some other problem, probably with gem versions or rails version.

Just for a test case - why dont you create a new test project, to see if it works there

rails new testproj
cd testproj
rails generate scaffold Person name:string
rake db:create db:migrate

Once that's done, just open your gemfile and add: gem "bullet", :group => "development"
Then in testproj/config/environments/development.rb file, add this

Rails.application.configure do
  ...
  config.after_initialize do
    Bullet.enable = true
    Bullet.alert = true
  end
  ...
end

Once done, just do bundle install and start rails server

If error still appears, update gems:-
gem update --system and then gem update

zhirzh
  • 3,273
  • 3
  • 25
  • 30
  • glad to help. By the way, could you please share some info about the use of bullet?
    What is it primarily used for?
    – zhirzh Aug 15 '14 at 17:43
  • The Bullet gem is designed to help you increase your application's performance by reducing the number of queries it makes. It will watch your queries while you develop your application and notify you when you should add eager loading (N+1 queries), when you're using eager loading that isn't necessary and when you should use counter cache. Copied directly from: https://github.com/flyerhzm/bullet – Mateusz Urbański Aug 18 '14 at 06:48