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