4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

gemのBulletの設定を書いたらエラーがでました

Last updated at Posted at 2015-05-10

RailsでgemのBulletを使用しようとしたところ、エラーが出て困りました。

BulletはN+1問題のログを出力してくれたりする便利gemです。Gemfileに書いてbundle installをした後に公式のままでやってみたところエラーがでました。

Bulletの設定をdevelopment.rbに記述

Github : https://github.com/flyerhzm/bullet
上記にはdevelopment.rbにconfig.after_initializeを書くようにあります。

development.rbに追記
vi 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.slack = { webhook_url: 'http://some.slack.url', foo: 'bar' }
end

development.rbに上記を記述したところエラーがでるようになりました。

rails sがエラー

rails sでサーバーを立ち上げようとするとエラーがでてしまいます。

serverがスタートできない
bundle exec rails s -b 0.0.0.0 -p 8888

/home/vagrant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/uniform_notifier-1.8.0/lib/uniform_notifier/growl.rb:16:in `rescue in rescue in setup_connection': You must install the ruby-growl or the ruby_gntp gem to use Growl notification: `gem install ruby-growl` or `gem install ruby_gntp` (UniformNotifier::NotificationError)

# もしくは

/home/vagrant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/uniform_notifier-1.8.0/lib/uniform_notifier/xmpp.rb:26:in `rescue in setup_connection': You must install the xmpp4r gem to use XMPP notification: `gem install xmpp4r` (UniformNotifier::NotificationError)

# もしくは

/var/www/html/pugiemonn.com/config/environments/development.rb:49:in `block (2 levels) in <top (required)>': undefined method `honeybadger=' for Bullet:Module (NoMethodError)

つまりruby-growlxmpp4rhoneybadgerというgemがないから入れろとメッセージにかかれています。

development.rbから該当箇所を削除

設定に書いてあったgemなどrakeでエラーがでたものはとりあえず使用しないので削除しました。

development.rbから設定を削除
vi config/environments/development.rb

config.after_initialize do
  Bullet.enable = true
  Bullet.alert = true
  Bullet.bullet_logger = true
  Bullet.console = true
  Bullet.rails_logger = true
  Bullet.bugsnag = true
  Bullet.airbrake = true
  Bullet.add_footer = true
  Bullet.stacktrace_includes = [ 'your_gem', 'your_middleware' ]
end

とりあえずエラーはでなくなりました。
ほかにも使用しない機能は削除しておくと良いですね(☝ ՞ਊ ՞)

4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?