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.
Render a view template for a browser - Ruby on Rails Tutorial
From the course: Ruby on Rails 6 Essential Training
Render a view template for a browser
- [Narrator] In this chapter, we're going to examine how the controllers and views work, and how they allow us to output dynamic content. We're going to begin by learning how templates are rendered. We've already seen the MVC Web Architecture diagram a couple of times. And in the last chapter we talked about the fact that the model and the database are really optional. The parts that are essential to every request and response is that the browser has to send a request to the controller, the controller then chooses a view template to send back to the browser. This triangle is what we're going to be focused on in this chapter. The three essential parts to this request-response loop. The first is that we need to have a route. That route determines how a URL is sent to the correct controller and action. Then we want to have a controller action that will perform whatever code we want to use as a response to it. And then…
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
-
-
-
-
-
Render a view template for a browser5m 35s
-
Redirect controller actions5m 13s
-
Define view templates using HTML5m 34s
-
Use instance variables to set values in the template3m 42s
-
Create links to other webpages4m 17s
-
Defining and reading URL parameters6m 38s
-
Challenge: Dynamic templates3m 22s
-
Solution: Dynamic templates6m 9s
-
-
-
-
-
-