Huh? I thought I unpacked the gem in the vendor directory? A quick directory list revealed that it was there: vendor/gems/ruby-prof-0.7.3
What could be wrong? I started to trace the request script to find this little gem call in the Rails source code:
# File actionpack/lib/action_controller/request_profiler.rb, line 146Really? Another Evil monkey patch in my source code:
146: def load_ruby_prof
147: begin
148: gem 'ruby-prof', '>= 0.6.1'
149: require 'ruby-prof'
150: if mode = options[:measure]
151: RubyProf.measure_mode = RubyProf.const_get(mode.upcase)
152: end
153: rescue LoadError
154: abort '`gem install ruby-prof` to use the profiler'
155: end
156: end
# File /lib/core_ext/action_controller/request_profiler.rb
def load_ruby_prof
begin
require 'ruby-prof'
if mode = options[:measure]
RubyProf.measure_mode = RubyProf.const_get(mode.upcase)
end
rescue LoadError
abort '`gem install ruby-prof` to use the profiler'
end
end
#config/environment.rb
Rails::Initializer.run do |config|
config.load_paths += Dir["#{RAILS_ROOT}/vendor/gems/**"].map do |dir|
File.directory?(lib = "#{dir}/lib") ? lib : dir
end
end
# Add pagination requirement
require "#{RAILS_ROOT}/lib/core_ext/action_controller/request_profiler"
No comments:
Post a Comment