Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Start a free Basic trial
to watch this video
We just updated our database, and we're still trying to load the list of Owners in our browser. But now we have another problem. It's reporting a routing error: "No route matches [GET] '/owners'".
If you'd like to know more about the HTTP protocol, check out our HTTP Basics course.
-
0:01
Okay, we just updated our database and we're still trying to load the list of
-
0:04
owners in our browser but now we have another problem.
-
0:07
It's reporting a routing error, no route matches [GET] slash owners.
-
0:12
The GET is an HTTP GET request.
-
0:15
It's what your browser sends when it wants to get a resource like the list of owners.
-
0:19
You can check out the teachers notes for more on the HTTP protocol and
-
0:24
/owners is the path at the end of our URL.
-
0:28
Rails needs a way to take that get request and path and
-
0:30
route it to the correct controller action.
-
0:34
To do that, you go into the config > routes.rb file.
-
0:39
So we'll go in there, and add a route for a get request,
-
0:44
with a path of /owners and
-
0:48
we'll have it go to the owner's controllers index actions.
-
0:53
So we'll send to owners#index action.
-
1:01
Save it.
-
1:03
If our controller had all the usual credit actions, like index,
-
1:06
show, new, edit, etc., we could just use the shortcut resources owners.
-
1:12
But for right now, we're just setting up the index section.
-
1:15
Now that we've got a route in place, if we reload the page again,
-
1:20
we see that our no route matches error goes away.
-
1:23
Gets replaced by a different one, but at least we're another step closer.
You need to sign up for Treehouse in order to download course files.
Sign up