1、打开bullet的github官网网页,认真阅读README.MD文件

2、在gemfile文件里,gem rails 及数据库gem的后面加上

gem 'bullet', group: 'development'

3、在config/environments/development.rb里加入初始化命令

config.after_initialize do
  Bullet.enable = true
  Bullet.alert = true
  Bullet.bullet_logger = true
  Bullet.console = true
  #Bullet.growl = true
  #Bullet.xmpp = { :account  => 'bullets_account@jabber.org',
  #                :password => 'bullets_password_for_jabber',
  #                 :receiver => 'your_account@jabber.org',
  #                :show_online_status => true }
  Bullet.rails_logger = true
  #Bullet.honeybadger = true
  #Bullet.bugsnag = true
  #Bullet.airbrake = true
  #Bullet.rollbar = true
  Bullet.add_footer = true
  #Bullet.stacktrace_includes = [ 'your_gem', 'your_middleware' ]
  #Bullet.stacktrace_excludes = [ 'their_gem', 'their_middleware' ]
  #Bullet.slack = { webhook_url: 'http://some.slack.url', channel: '#default', username: 'notifier' }
end

由于是本地开发使用的,因此不需要使用发信及关联其他软件,故将相关的选项屏蔽

4、打开localhost:3000,依次打开相关网页测试是否需要进行后端优化

5、针对对应的N + 1 Query、Table Scan、counter cache、index来进行优化。