Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Missing Components - Routes1:27 with Jay McGavren
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'".
Okay, 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] slash owners.
The GET is an HTTP GET request.
It's what your browser sends when it wants to get a resource like the list of owners.
You can check out the teachers notes for more on the HTTP protocol and
/owners is the path at the end of our URL.
Rails needs a way to take that get request and path and
route it to the correct controller action.
To do that, you go into the config > routes.rb file.
So we'll go in there, and add a route for a get request,
with a path of /owners and
we'll have it go to the owner's controllers index actions.
So we'll send to owners#index action.
If our controller had all the usual credit actions, like index,
show, new, edit, etc., we could just use the shortcut resources owners.
But for right now, we're just setting up the index section.
Now that we've got a route in place, if we reload the page again,
we see that our no route matches error goes away.
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