Tag: rack mini profiler

如何配置使用rack-mini-profiler返回json响应的rails控制器?

我在rails 3.2项目中使用rack-mini-profiler。 在gemfile中: gem ‘rack-mini-profiler’ 一切都很好。 但我的应用程序主要是一组json端点。 因此,虽然能够检查html页面的性能非常有用,但我还希望能够看到返回json的控制器的性能。 我的控制器示例: class UsersController < BaseController def json_method # you don't see the mini profiler ui for this controller render json: { users: [:foo, :bar]} end end 如果我去localhost:3000/users/json_method ,我会看到我的json响应但不是profiler ui。