The V in Rails’ MVC: templates and helpers
In a classic Rails application, we make the view layer from HTML templates. The framework introduces conventions for organizing templates that can be found if you take a look at an example project’s app/views
folder. If we generated the User resource using the Rails scaffolding system (rails g resource user
), we would see the following files:
app/ views/ layouts/ application.html.erb users/ _form.html.erb _user.html.erb edit.html.erb index.html.erb new.html.erb show.html.erb
First, we have layouts
—top-level templates that wrap endpoint-specific templates and contain metadata and other utility information required...