Installing ruby-prof as a plugin on Rails 1.2
gem install ruby-prof
cp -r $GEM_HOME/gems/ruby-prof-0.6.0/rails_plugin/ruby-prof vendor/plugins
More instructions on how to use ruby-prof with rails.
You’ll want to exclude that plugin from your non-development environments using techniques like these.
In config/database.yml:
Copy your database adapter to a new config called profile.
In config/environments.rb:
config.plugins = Rails::Initializer.new(config).send(:find_plugins, config.plugin_paths).map {|path| File.basename(path)}
config.plugins -= %W(ruby-prof)
Copy config/environments/development.rb to config/environments/profile.rb
In config/environments/profile.rb:
Add these lines
config.cache_classes = true
config.plugins = nil
Restart your server:
script/server -e profile
Make sure to change your tail -f log/profile.log !!!
This is for Rails 1.2. It’s a bit simpler to do with Rails 2.0
• Text tagged as: