omgreenfield / sandbox

Repo for learning different technologies
0 stars 0 forks source link

Debugging in Rails #41

Open omgreenfield opened 9 years ago

omgreenfield commented 9 years ago

pry for basic rails console at certain line of code pry-stack_explorer (https://github.com/pry/pry-stack_explorer) for stack... exploring. pry-debugger (https://github.com/nixme/pry-debugger) for breakpoints and stepping pry-remote (https://github.com/Mon-Ouie/pry-remote) for remote debugging

omgreenfield commented 9 years ago

Some pry commands:

  1. binding.pry to set "breakpoint"
  2. disable-pry to disable all breakpoints
  3. ls to look around
  4. whereami to see code above and below. whereami -n X to specify X lines above and below
  5. cd <object> to go into a particular object
  6. quit to continue running code until the next binding.pry line
omgreenfield commented 9 years ago

Note that your gemfile should have the following if you want to actually use pry-debugger:

gem 'pry'
gem 'pry-debugger'