Rails 4.1.2 can't install bullet gem

1.7k Views Asked by At

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.

1

There are 1 best solutions below

2
On BEST ANSWER

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