1 00:00:00,330 --> 00:00:03,230 When we submit our form for a new page we see the error, 2 00:00:03,230 --> 00:00:06,770 no route matches post /pages. 3 00:00:06,770 --> 00:00:11,567 Notice that it's not saying get pages, it's saying post. 4 00:00:11,567 --> 00:00:15,100 HTTP Get requests are intended for getting data from the server. 5 00:00:15,100 --> 00:00:16,900 When you're adding new data and 6 00:00:16,900 --> 00:00:20,660 you're supposed to use an HTTP POST request instead. 7 00:00:20,660 --> 00:00:23,720 So when you click the submit button on an HTML form 8 00:00:23,720 --> 00:00:27,160 a POST request as what your browser sends to the server. 9 00:00:27,160 --> 00:00:29,150 We only have get requests routes for 10 00:00:29,150 --> 00:00:32,350 pages right now though, we'll need to add a post route. 11 00:00:32,350 --> 00:00:36,386 We do that by calling the post method instead of the get method within route 12 00:00:36,386 --> 00:00:37,030 dot rb. 13 00:00:37,030 --> 00:00:40,175 We'll route all post requests for 14 00:00:40,175 --> 00:00:45,493 the /pages path to the PagesController's create method. 15 00:00:48,839 --> 00:00:51,218 We already have a get /pages route but 16 00:00:51,218 --> 00:00:54,900 it's okay to have a post /pages route as well. 17 00:00:54,900 --> 00:00:57,860 The two different request types get routed separately. 18 00:00:57,860 --> 00:01:01,450 There's also no risk of the router confusing a post request with the other 19 00:01:01,450 --> 00:01:05,500 get request, so we don't have to worry about what order we add the route in. 20 00:01:05,500 --> 00:01:08,430 If we save this and submit our form again from our browser, 21 00:01:08,430 --> 00:01:12,730 we'll see the action create cannot be found for PagesController. 22 00:01:12,730 --> 00:01:15,810 It looks like our request is being routed to the right place. 23 00:01:15,810 --> 00:01:18,190 Now we just need to add the create method to handle it.