14

I'm using rack-mini-profiler after watching it's railscast (http://railscasts.com/episodes/368-miniprofiler).

I added it to my Gemfile:

gem 'rack-mini-profiler'

Installed it using bundler and started my dev environment using "rails s". The profilling works, it shows up at the left upper corner of the web page, but it happens to profile all the static files (js, css, images, etc). It also seems that it has a limit of 10 lines, so the actual request is hidden.

enter image description here

enter image description here

Is it possible to configure it so it will avoid profiling static files?

Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338
razenha
  • 7,660
  • 6
  • 37
  • 53

1 Answers1

14

Ok, here's how I have done it:

Used the 0.0.18 version of the gem (which is not on rubygems.org, you'll have to install it from the project's git repo) and created a config file at /config/initializers/miniprofiler.rb:

Rack::MiniProfiler.config.skip_paths << "/images/"
Rack::MiniProfiler.config.skip_paths << "/stylesheets/"
Rack::MiniProfiler.config.skip_paths << "/javascripts/"
Rack::MiniProfiler.config.skip_paths << "/favicon.ico"

That did the trick

razenha
  • 7,660
  • 6
  • 37
  • 53
  • do you mind updating the doco on github, also we should probably update our railtie for this, can you post a bug on http://community.miniprofiler.com – Sam Saffron Jul 30 '12 at 09:35
  • I'm having this same issue (5 years later!) and I attempted to correct it with this answer but didn't work. Also I have installed the following version of mini profiler `rack-mini-profiler-0.10.7` – daveomcd Nov 30 '17 at 19:37