rack-mini-profiler
Profiler for your development and production Ruby rack apps.
Trying to disable rack-mini-profiler by default across all environments, as I only want to enable it for specific requests.
Tried disabling the pre-authorization in the initializer:
Rack::MiniProfiler.config.pre_authorize_cb = lambda { |env| false }
and then created this before_action in my controller:
def do_profiling
Rack::MiniProfiler.authorize_request if params[:profile] == 'mini'
end
But the profiler won't show up.
Source: (StackOverflow)
In my Rails 4 app I created these two helper functions:
def link_to_switch_off_miniprofiler
link_to "OFF", "?pp=disable"
end
def link_to_switch_on_miniprofiler
link_to "ON", "?pp=enable"
end
Is there any way to detect if MiniProfiler is currently enabled or disabled, so I can combine my two functions into one?
Thanks for any help.
Source: (StackOverflow)
I managed to get rack-mini-profiler
gem to run fine on the full pages we serve in our app. What I didn't manage is, how to directly get the data also for one of the calls we serve via ajax to another page. I found, that if I do the ajax call and then call one of our full page requests, I see also the ajax timing, but this is kind of cumbersome to do.
Do you have any tips on how to see the small menu also directly on the page where the ajax call is done? Our ajax call is returning html and there would be enough space to show the menu.
Source: (StackOverflow)
I must to enable rack-mini-profiler for dev and production. In ApplicationController I have:
before_filter :miniprofiler
def miniprofiler
Rack::MiniProfiler.authorize_request #if current_user.admin?
end
In config/initializers/rack_profiler.rb
if Rails.env == 'development'
require 'rack-mini-profiler'
Rack::MiniProfilerRails.initialize!(Rails.application)
end
In dev environment all works fine, but when i push to staging on Heroku, server falls with the
NameError (uninitialized constant Rack::MiniProfiler)
in this line
Rack::MiniProfiler.authorize_request #if current_user.admin?
I tried add
reqire 'rack-mini-profiler' to ApplicationController
but then I cann't even push it to staging with
Push rejected, failed to compile Multipack app
What i am missing?
Source: (StackOverflow)
I am using rack-mini-profiler in my rails 3.2 project.
In gemfile:
gem 'rack-mini-profiler'
Everything works great. But my application is mostly a set of json endpoints. So while it is very useful to be to able to inspect the performance of html pages, I would like to also be able to see the performance of controllers that return json.
Example of my controller:
class UsersController < BaseController
def json_method
# you don't see the mini profiler ui for this controller
render json: { users: [:foo, :bar]}
end
end
If I go to localhost:3000/users/json_method
, I see my json response but not the profiler ui.
Source: (StackOverflow)
Long story short, I've installed rack-mini-profiler into my Dev environment. I'm not able to load rack-mini-profiler on any route aside from "home#index" (http://whatever.com:3000). I'd like to extend this into my routes (http://whatever.com:3000/venues).
Here's my routes.rb file:
Rails.application.routes.draw do
devise_for :admins, :controllers => {:sessions => 'sessions'}
resources :venues
root to: "home#index"
get "venues/about"
This is probably a fairly newbish question, but I'm somewhat stumped at this point.
What's the deal?
Source: (StackOverflow)