From the course: Ruby on Rails 6 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Solution: Dynamic templates

Solution: Dynamic templates - Ruby on Rails Tutorial

From the course: Ruby on Rails 6 Essential Training

Start my 1-month free trial

Solution: Dynamic templates

(upbeat music) - [Instructor] Hopefully you did well with this challenge assignment. Now I'll show you the solution that I came up with. We know that we want to add two new actions to the demo controller, and we know that actions need to have a route that points to them. So in the route file I've added two new routes. I've used get and then demo about, and demo contact. These are the strings that are going to go in the browser in order to activate these actions. Then in the demo controller I've added two actions, about and contact. Now I'm also going to be using two templates for those. At least for the moment the about page is not going to be dynamic. It's just going to be a static piece of text. But I do need to include render with about_us. That's because I can't rely on the default name of the action to pull up a default template. Instead, I need to specify that it's going to have a different name. I don't…

Contents