Views and Models

Learn about views and models of our Rails application.

We'll cover the following

Views

Rails support for rendering HTML web views is quite sophisticated and powerful. In particular, the coupling between the Active Model and Rails’ form helpers is very tight (a great example of the power in tightly coupling components). Actions performed by boundary classes that result in dynamic output (usually controllers and mailers) will initiate the rendering of the view from a template, and that template may pull in JavaScript, CSS, or other templates (partials).

Often, the templates are HTML, but they can be pretty much anything, including JSON, text, or XML. Templates also have access to helpers, which are free functions in the global namespace. Rails provides many helpers by default, and we can make our own.

Get hands-on with 1200+ tech skills courses.