From the course: Ruby on Rails 6 Essential Training
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Read action: Show - Ruby on Rails Tutorial
From the course: Ruby on Rails 6 Essential Training
Read action: Show
- [Narrator] In this movie we will learn how to implement the show action, which is the other common reaction used for CRUD. We already learned how to use index to return a list of records. Now we want to use show to look at details about a particular record. One key difference about show is it's going to require an ID and that ID must exist in the database. If it doesn't, rails is going to return a record not found error. So we're going to use that ID to tell it which record we want to see the details of. Before we start coding the show action, let's create a link that'll get us to it. So from the index page, what we want is for this show link to take us to a detail view for subject with ID one and this one to have a link that takes us to details about subject two. The placeholder for that link is down here and we just have a placeholder action now. We want to replace that with a proper target. You could…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
Read action: Index4m 20s
-
Read action: Show4m
-
Adding basic forms to templates4m 51s
-
Create action: New4m 12s
-
Create action: Create5m 5s
-
Using strong parameters to regulate input4m 57s
-
Update actions: Edit and update6m 19s
-
Using partials and helpers to organize code6m 36s
-
Delete actions: Delete and destroy5m 50s
-
Challenge: Pages CRUD1m 23s
-
Solution: Pages CRUD4m 50s
-
-