This a short summary of the techniques presented in a RailsConf talk by Godfrey Chan.

  • Find documentation on http://api.rubyonrails.org
    Find documentation for a specific version on http://api/rubyonrails.org/v4.1.10

  • In order to see the whole stack trace, uncomment the Rails.backtrace_cleaner.remove_silencers! line in the config/initializers/backtrace_silencers.rb file. Then raise an expection on line you want to debug.

  • debug with byebug

  • pp caller returns the current execution stack

  • pp instance_values returns a hash with all the instance variables on the object

  • Use the Object#method that returns a Method object

method(:method_name).source_location
method(:method_name).owner


For even more options on what to call to the Method object, include

gem "method source"
  • make changes to the gem files with bundle open [GEM_NAME]
    and restore them to their original state with gem pristine [GEM_NAME] Gem files aren’t reloaded by Rails though, so remember to restart the server between changes.

  • Include rails from a locally forked version

gem "rails", path "~/myfork/rails/"


This allows you, for example, to checkout from one version to another

  • git the history of the file
git log file
git blame file
git show a1b2c3d4 file # Show file at specific commit
git show a1b2c3d4^ file # Show file with the commit as a parent

The whole lecture