Test Your Knowledge
Quiz
What’s the easiest way to present debugging information in a Rails view?
Where can you find information about how quickly different aspects of a request were handled?
How can you test routing from the console?
How do you tell your program to support the Ruby debugger?
How do you let your program continue when you exit the Ruby debugger?
Answers
The
debugmethod makes it easy to present the complete contents of an object in a mostly readable YAML representation..Rails includes a lot of timing information in its development log, which is available both in the terminal window for
script/serverand in the log/development.log file.You can test simple routes by calling
app.url_for. If you need to test named routes,include ActionController:UrlWriterand then try calling the path methods.By adding
require "ruby-debug"to the config/environments/development.rb file.When you use the
contcommand, rather than thequitcommand, the debugger lets Rails get back to what it was doing. Thequitcommand exits the debugger and shuts down the application.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access