Commit 7dd276817c6459e0fdf6524f1b8e51decd385986
1 parent
9bf7c1ee
Exists in
master
and in
4 other branches
Rack mini profiler for dev env
Showing
3 changed files
with
9 additions
and
0 deletions
Show diff stats
Gemfile
@@ -60,6 +60,7 @@ group :development do | @@ -60,6 +60,7 @@ group :development do | ||
60 | gem "letter_opener" | 60 | gem "letter_opener" |
61 | gem "rails-footnotes" | 61 | gem "rails-footnotes" |
62 | gem "annotate", :git => "https://github.com/ctran/annotate_models.git" | 62 | gem "annotate", :git => "https://github.com/ctran/annotate_models.git" |
63 | + gem 'rack-mini-profiler' | ||
63 | end | 64 | end |
64 | 65 | ||
65 | group :development, :test do | 66 | group :development, :test do |
Gemfile.lock
@@ -237,6 +237,8 @@ GEM | @@ -237,6 +237,8 @@ GEM | ||
237 | rack (1.4.1) | 237 | rack (1.4.1) |
238 | rack-cache (1.2) | 238 | rack-cache (1.2) |
239 | rack (>= 0.4) | 239 | rack (>= 0.4) |
240 | + rack-mini-profiler (0.1.9) | ||
241 | + rack (>= 1.1.3) | ||
240 | rack-mount (0.8.3) | 242 | rack-mount (0.8.3) |
241 | rack (>= 1.0.0) | 243 | rack (>= 1.0.0) |
242 | rack-protection (1.2.0) | 244 | rack-protection (1.2.0) |
@@ -408,6 +410,7 @@ DEPENDENCIES | @@ -408,6 +410,7 @@ DEPENDENCIES | ||
408 | omniauth-ldap! | 410 | omniauth-ldap! |
409 | pry | 411 | pry |
410 | pygments.rb! | 412 | pygments.rb! |
413 | + rack-mini-profiler | ||
411 | rails (= 3.2.5) | 414 | rails (= 3.2.5) |
412 | rails-footnotes | 415 | rails-footnotes |
413 | raphael-rails (= 1.5.2) | 416 | raphael-rails (= 1.5.2) |
app/controllers/application_controller.rb
@@ -4,6 +4,7 @@ class ApplicationController < ActionController::Base | @@ -4,6 +4,7 @@ class ApplicationController < ActionController::Base | ||
4 | before_filter :set_current_user_for_mailer | 4 | before_filter :set_current_user_for_mailer |
5 | before_filter :check_token_auth | 5 | before_filter :check_token_auth |
6 | before_filter :set_current_user_for_observers | 6 | before_filter :set_current_user_for_observers |
7 | + before_filter :dev_tools if Rails.env == 'development' | ||
7 | 8 | ||
8 | protect_from_forgery | 9 | protect_from_forgery |
9 | 10 | ||
@@ -142,4 +143,8 @@ class ApplicationController < ActionController::Base | @@ -142,4 +143,8 @@ class ApplicationController < ActionController::Base | ||
142 | def render_full_content | 143 | def render_full_content |
143 | @full_content = true | 144 | @full_content = true |
144 | end | 145 | end |
146 | + | ||
147 | + def dev_tools | ||
148 | + Rack::MiniProfiler.authorize_request | ||
149 | + end | ||
145 | end | 150 | end |