gpt4 book ai didi

ruby-on-rails - 如何让 mini-profiler 在 rails 中启动

转载 作者:行者123 更新时间:2023-12-04 19:51:33 28 4
gpt4 key购买 nike

我已经在 Rails 4 (rc1) 应用程序中安装了 mini-profiler gem,但是当我加载该应用程序时,它没有在浏览器中显示带有加载时间统计信息的小窗口。

根据我正在观看的 Railscast,它应该在将其添加到 gemfile、运行 bundle 并重新启动应用程序后开始工作。

你能建议我如何让它工作吗?

gem 文件

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'

最佳答案

我只是想抛出我今天学到的东西,因为我正在努力让 rack-mini-profiler 工作,希望它能帮助其他人。

如果您使用的是 Rack::Deflater,它将导致它无法将探查器插入正文。经过相当多的挖掘后,我发现在 v0.9.2 中它正在对响应主体进行正则表达式并插入自身。使用 Rack::Deflater 时,主体是二进制格式,正则表达式永远无法成功找到合适的位置来插入自身。

我所做的只是将配置行移动到 environment/production.rb

config.middleware.use Rack::Deflater

关于ruby-on-rails - 如何让 mini-profiler 在 rails 中启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17025563/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com