Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Missing Components - Controllers1:32 with Jay McGavren
We set up a route to the OwnersController here in `config/routes.rb`, but we haven't created the controller class within the `controllers/` directory yet. Let's do that now.
Okay, we've added the missing route needed to handle our requests but 0:00 we're still getting errors. 0:03 The new error says uninitialized constant owner's controller. 0:05 The reason for that is simple enough. 0:09 We set up a route to the owners controller here and config route start RB, 0:11 but we're still missing that controller. 0:15 Let's create the controller class within the controllers directory now. 0:18 We'll go to the terminal. 0:22 Quit out of our Rails server and type, rails 0:24 generate the controller. 0:29 Specify that it should create an owner's controller and 0:34 we'll set up a single action index. 0:38 Rails will generate the owners controller file at app 0:43 controllers owners controller dot rb. 0:47 We won't set it up right now to load or display any owner objects, 0:51 since that's not really relevant to this troubleshooting workshop. 0:55 But, if we refresh our browser now, After restarting the Rails server that is. 0:58 We'll see that we're finally processing the requests successfully. 1:07 We've just seen how to fix problems that prevent Rails from handling a request. 1:12 We've run migrations to ensure the database is up to date. 1:16 Added missing routes so Rails knows where to send the request, and 1:19 added the missing controller action so there's someplace to send the request to. 1:22 In the next video, we'll look at how to fix typos and other mistakes in your code. 1:26
You need to sign up for Treehouse in order to download course files.Sign up