我在Rails 4(rc1)应用程序中安装了mini-profiler gem但是当我加载应用程序时,它没有在浏览器中显示带有加载时间统计信息的小窗口。
根据我正在观看的Railscast,它应该在将它添加到gemfile,运行bundle并重新启动应用程序后开始工作。
你能建议我做些什么才能让它发挥作用吗?
的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'
答案 0 :(得分:4)
我只是想抛弃我今天学到的东西,因为我正努力让机架迷你探测器工作,希望它能帮助别人。
如果您使用的是Rack :: Deflater,则会导致它无法将探查器插入体内。经过相当多的挖掘后,我发现在v0.9.2中,它正在重新响应主体并插入自身。使用Rack :: Deflater,正文是二进制格式,正则表达式永远不会成功找到插入自身的适当位置。
我所做的只是将配置行移动到environment / production.rb
config.middleware.use Rack::Deflater
答案 1 :(得分:2)
我遇到了同样的问题,并将其添加到config.ru:
require 'rack-mini-profiler'
use Rack::MiniProfiler
答案 2 :(得分:0)
对我来说,我正在使用heroku-deflater
。我把那个宝石搬进了生产宝石组:
group :production do
# ...
gem 'heroku-deflater', '~> 0.5'
end
... and rack-mini-profiler开始工作。