ruby-on-railsruby-on-rails-3rails-bullet

Is it possible to show the gem bullet's aleter only when User.id == 1?


I'm using the gem called "bullet" https://github.com/flyerhzm/bullet This help to avoid N + 1 problem.

I'd like to use this in production mode with my account(User.id==1) Is it possible?

I've coded this in /config/environments/production.rb but the alert pops up whoever the users access.

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

Solution

  • I dont know, but you should copy the production database to your local host and try it there, if you dont have enough testing data..

    Usually its not recommended to run development gems in production.

    ==

    You can show the bullet output only in the bullet log files (this is not related to user on, but to all users in general):

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

    Afterwards you can watch the output in the bullet.log file