Search⌘ K
AI Features

When Things Go Wrong

Understand how to handle common errors in Rails by exploring typo-induced bugs and URL issues. Learn to use Rails’ web console to debug and evaluate code, gain confidence in verifying your Rails installation, and prepare for building real applications.

Let’s start by introducing a typo in the source code (highlighted in the below code) that perhaps was introduced by a misfiring autocorrect function in your favorite editor:

Typing
Ruby
class SayController < ApplicationController
def hello
@time = Time.know
end
def goodbye
end
end

Demonstration of typos

Run the application provided below to see the typo error.

Bud1
ocblobappIlocblobA.������appbwspblob�bplist00�


]ShowStatusBar[ShowPathbar[ShowToolbar[ShowTabView_ContainerShowSidebar\WindowBounds[ShowSidebar		_{{3, 67}, {1437, 808}}	%1=I`myz{|}~��appvSrnlongbabel.config.jsIlocblob�.������binIlocblob.������configIlocblob�.������	config.ruIlocblob�.������dbIlocblobg.������GemfileIlocblobA�������libIlocblob��������package.jsonIlocblob�������postcss.config.jsIlocblob��������publicIlocblob��������RakefileIlocblobg�������storageIlocblobA������testIlocblob�������vendorIlocblob������ @� @� @� @E
DSDB `� @� @� @
This will show the typo errors as discussed above

This is similar to what we saw before, but in place of source code we see a list of possible routes, how they can be accessed, and the controller action they’re associated with. We’ll explain all of this in detail ...