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 - Ruby on Rails Tutorial
From the course: Ruby on Rails 6 Essential Training
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…
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
-
-
-
-
-
(Locked)
Render a view template for a browser5m 35s
-
(Locked)
Redirect controller actions5m 13s
-
Define view templates using HTML5m 34s
-
(Locked)
Use instance variables to set values in the template3m 42s
-
(Locked)
Create links to other webpages4m 17s
-
(Locked)
Defining and reading URL parameters6m 38s
-
(Locked)
Challenge: Dynamic templates3m 22s
-
(Locked)
Solution: Dynamic templates6m 9s
-
(Locked)
-
-
-
-
-