-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinit.rb
More file actions
22 lines (21 loc) · 768 Bytes
/
init.rb
File metadata and controls
22 lines (21 loc) · 768 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
begin
gem 'ruby-prof', '>= 0.7.3'
rescue Gem::LoadError
module MissingActionProfiler
def action_profiler(*args)
logger.info "`gem install ruby-prof` to enable action profiling."
yield if block_given?
end
end
class ActionController::Base
extend MissingActionProfiler
include MissingActionProfiler
logger.info "Action profiling disabled. `gem install ruby-prof` to enable."
end
else
require 'action_profiler'
class ActionController::Base
include ActionController::ActionProfiler
logger.info "Action profiling enabled. Add around_filter :action_profiler to ApplicationController then append ?profile=process_time to any URL to profile the page load and download a calltree file. Open it with kcachegrind."
end
end