Introduction2:03 with Jay McGavren
It's time to take the training wheels off! In our Rails Basics course, we created a simple blog app. And we saw how to set up the model, view, and controller for our Post resource automatically, using a scaffold. But we also learned that scaffolds don't offer you much control over how your finished resource looks. So in this course, we're going to create a resource completely from scratch. We're also going to introduce a concept we haven't looked at thus far: Rails "routes". Routes are how Rails sends a particular request to the particular controller that can handle it.
[MUSIC] 0:00 It's time to take the training wheels off. 0:04 In our Rails Basics course, we created a simple blog app. 0:06 And we saw how to set up the model, view, and controller for 0:10 our posts resource automatically using a scaffold. 0:13 But we also learned that scaffolds don't offer you much control over how your 0:16 finished resource looks. 0:19 So in this course, we're going to create a resource completely from scratch. 0:21 We're also going to introduce a concept we haven't looked at thus far, Rails routes. 0:25 Routes are how Rails sends a particular request to the particular controller that 0:30 can handle it. 0:34 Here's what we're going to make in this course. 0:35 You've probably seen blogs that have pages in addition to posts. 0:37 These are usually permanent features like an About Me page or 0:42 a resume that are linked from the site's main menu. 0:45 The links are usually human readable too. 0:48 Instead of putting a page ID in the URL, an easily readable slug string is used. 0:51 This sounds useful for our blog. 0:56 So let's set up a Pages resource of our own. 0:58 We're just going to set the resource up for right now. 1:00 We'll create links that use the paid slugs in a later course. 1:03 In the first stage, we'll read all page records in the database and 1:06 display their titles in a list. 1:10 Since we won't yet have a form for adding pages, 1:12 we'll have to add some via the Rails console. 1:14 This first stage will be the most involved since we'll need to set up a route, 1:17 a controller, a view and a model for our pages. 1:20 In later stages, we'll just add features onto the base we've created. 1:24 We'll add the ability to read a single page record and display that by itself. 1:27 Then we'll set up a form that allows users to create new page records and 1:32 another form for updating existing pages. 1:36 Last, will let users delete pages they don't want anymore. 1:38 If you haven't completed Rails Basics yet, check the course page for a link there. 1:42 You'll need the Rails Basics blog app as a starter. 1:46 And remember to check the teacher's notes as you work through this course. 1:49 We'll have links to useful resources where you can learn more about each topic. 1:53 If you get stuck, be sure to post a question in the Treehouse community. 1:57 Bling, let's get started. 2:01
You need to sign up for Treehouse in order to download course files.Sign up