Question

I've installed mini-profiler gem in a Rails 4 (rc1) application but when I load the application it's not showing the little window with load time statistics in the browser.

According to the Railscast I'm watching, it should start working after adding it to the gemfile, running bundle and restarting the application.

Can you suggest what I might do to get it working?

Gemfile

gem 'rails', '4.0.0.rc1'

gem 'devise', '3.0.0.rc'
gem "rolify"
gem  'cancan'
gem 'simple_form', '3.0.0.rc'
gem 'backbone-on-rails'
gem 'geocoder'
gem 'pg_search'
gem 'sidekiq'

gem 'gmaps4rails'

# Use postgresql as the database for Active Record
gem 'pg'
gem 'will_paginate'
gem "figaro", ">= 0.6.3"
gem 'stripe'
gem "stripe_event"
gem 'jquery-turbolinks'
gem 'dalli'


# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0.rc1'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'



# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.0.1'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end
gem 'rack-mini-profiler'
Was it helpful?

Solution 2

I ran into the same problem and got it to work by adding this to config.ru:

require 'rack-mini-profiler'
use Rack::MiniProfiler

OTHER TIPS

I just wanted to throw out something I learned today as I was struggling to get rack-mini-profiler to work, hopefully it will help others.

If you are using Rack::Deflater it will cause it to not insert the profiler into the body. After quite a bit of digging I found that in v0.9.2 it is regexing the body of the response and inserting itself. With Rack::Deflater the body is in a binary format and the regex never succeeds to find the appropriate location to insert itself.

All I did was move the config line into the environment/production.rb

config.middleware.use Rack::Deflater

With mine, I was using heroku-deflater. I moved that gem into the production gem group:

group :production do
  # ...
  gem 'heroku-deflater', '~> 0.5'
end

... and rack-mini-profiler started working.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top