Learn to implement a basic “show” action by writing controller code and the related HTML for the view template. The show action is a Read operation which displays a single database record.
- [Instructor] In this movie,…we will learn to implement the show action,…which is the other common read action used for CRUD.…In the last movie, we used index…to return a list of records.…One key difference about show is that…it's going to require an ID,…and that ID must exist in the database.…Otherwise rails would return a record not found error.…We can't view the details of a record…if we can't look it up by ID or if it's not there.…Let's add the link to the show page on the index template.…We'll be sure to add that ID.…In my list of subjects, I already have links for show…but they're just place holders at the moment.…
Let's go into our code…and right here where we have link to, show,…let's add this URL.…Now there are three different ways that we can…write this URL since we've defined…our resourceful route on it.…The first is we could just say subjects…and then slash and then inside here…we could drop in subject.id, right, that would work.…That would generate a URL that had subjects…followed by the ID and that's what we're looking for.…
- 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.