Skip to content

Instantly share code, notes, and snippets.

@zhuochun
Created January 4, 2014 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhuochun/8256897 to your computer and use it in GitHub Desktop.
Save zhuochun/8256897 to your computer and use it in GitHub Desktop.
Ruby debugging

Gems

gem 'debugger', group: [:development, :test]

Debugging

  • Add debugger to anywhere in code that needs a breakpoint.
  • Refresh the page, the rails server terminal will stop, use help.
    • list or l show the line in code
    • pp is pretty print a variable
    • step, next/n, continue
    • irb to ruby shell

Other Tips

  • range = date.beginning_of_day..date.end_of_day

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment