Ruby on Rails provides helper methods to assist in generating the URLs for resourceful routes. These helper methods follow a pattern. Learning the logic behind the pattern will make working with REST and with resourceful routes much easier.
- [Narrator] One benefit to using resourceful routes…is how much typing it saves us.…And the reason why that's possible,…is because of Rails sensible defaults…and because there's some good helper methods…that we can use in our links and in our forms.…Let's take a look.…In the past, when we've wanted to generate a link,…we wanted to provide a URL.…We could either provide a string, that was actually the URL,…or we could have Rails construct that for us…by giving it a hash.…And we would just specify the controller and the action…that we wanted and Rails would handle…going through the routes file to figure out…how to turn that into a URL.…
Now, with resourceful routes,…we have some helpers that can help even further.…Instead of having to write out controller,…subjects, action, show, id, 5, we can use the helper…and simply say, subject_path(5).…And that will generate the exact same URL.…But it will reduce the amount of code…that we have to write and maintain.…So, that's an example of a resourceful URL helper.…Let's talk about what all of them are.…
- Creating and configuring a new Ruby on Rails project
- Generating controllers and views
- Handling server requests
- Using different types of routes
- Rendering and viewing templates
- Generating migrations and models
- Creating, updating, and deleting records
- Finding records with queries
- Understanding relationship types
- Writing controllers for CRUD
- Working with layouts and helpers
- Managing application assets
- Building forms
- Validating data
- Authenticating users
Skill Level Beginner
1. What Is Ruby on Rails?
2. Get Started
3. Controllers, Views, and Dynamic Content
4. Databases and Migrations
5. Models and ActiveRecord
7. CRUD, REST, and Resourceful Routes
8. Controllers and CRUD
9. Layouts, Partials, and View Helpers
12. Data Validation
13. Controller Features
14. User Authentication
15. Improve the Simple CMS
Next steps1m 44s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.