From the course: Ruby on Rails 5 Essential Training

Unlock the full course today

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

Render a template

Render a template - Ruby on Rails Tutorial

From the course: Ruby on Rails 5 Essential Training

Start my 1-month free trial

Render a template

- [Narrator] In this chapter, we're going to examine how the controllers and views work and how they allow us to output dynamic content. And we're going to begin by learning how templates are rendered. Let's review the MVC diagram. The end of the last chapter, we saw how browser requests are routed to the correct controller and action. At that point, the controller takes over. And the controller's job is to control, control the flow through the application and to make choices about how to respond to the request. The controller could access our model and our databases during this process, but it doesn't have to. So let's set those aside for now and focus on how the controller decides which view should be used. In the last chapter, we generated a demo controller which also created a demo directory in our views and added a file for our index action. This file is called a view template. It's a template because most of the time it's going to have dynamic content added to it. Let's try…

Contents