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

Read action: Show - Ruby on Rails Tutorial

From the course: Ruby on Rails 6 Essential Training

Start my 1-month free trial

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…

Contents