From 7c748884f3d5ece32708c77aa9bcd74fed89543b Mon Sep 17 00:00:00 2001 From: Priit Tamboom Date: Thu, 9 Oct 2014 17:39:54 +0300 Subject: [PATCH] added bullet for finding database optimizations --- Gemfile | 3 +++ Gemfile.lock | 5 +++++ config/environments/development.rb | 9 +++++++++ config/environments/test.rb | 7 +++++++ 4 files changed, 24 insertions(+) diff --git a/Gemfile b/Gemfile index dfdd0dfc5..86425e55f 100644 --- a/Gemfile +++ b/Gemfile @@ -128,4 +128,7 @@ group :development, :test do # For code review gem 'simplecov', '~> 0.9.1', :require => false + + # for finding database optimizations + gem 'bullet', '~> 4.14.0' end diff --git a/Gemfile.lock b/Gemfile.lock index fe2a7bc2f..accbf08d1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -37,6 +37,9 @@ GEM bootstrap-sass (3.2.0.2) sass (~> 3.2) builder (3.2.2) + bullet (4.14.0) + activesupport (>= 3.0.0) + uniform_notifier (>= 1.6.0) cancan (1.6.10) capybara (2.4.1) mime-types (>= 1.16) @@ -267,6 +270,7 @@ GEM kgio (~> 2.6) rack raindrops (~> 0.7) + uniform_notifier (1.6.2) uuidtools (2.1.5) warden (1.2.3) rack (>= 1.0) @@ -284,6 +288,7 @@ PLATFORMS DEPENDENCIES bootstrap-sass (~> 3.2.0.1) + bullet (~> 4.14.0) cancan (~> 1.6.10) capybara (~> 2.4.1) coffee-rails (~> 4.0.0) diff --git a/config/environments/development.rb b/config/environments/development.rb index 713b0f117..7e3c7dfc0 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -36,4 +36,13 @@ Rails.application.configure do # config.action_view.raise_on_missing_translations = true config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } + + # for finding database optimization + config.after_initialize do + Bullet.enable = true + Bullet.bullet_logger = true + Bullet.console = true + Bullet.rails_logger = true + Bullet.add_footer = true + end end diff --git a/config/environments/test.rb b/config/environments/test.rb index 82ca38674..dfc9384e2 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -36,4 +36,11 @@ Rails.application.configure do # Raises error for missing translations # config.action_view.raise_on_missing_translations = true + + # for finding database optimization + config.after_initialize do + Bullet.enable = true + Bullet.bullet_logger = true + Bullet.raise = true # raise an error if n+1 query occurs + end end