ruby-on-railsrubyruby-on-rails-4.1rails-bullet

Rails 4.1.2 can't install bullet gem


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.


Solution

  • 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