In this section you'll learn how to work with Views in Rails, including: using custom layout files, working with partials, using Rails view helpers, and how to dynamically generate HTML code.
Rails provides a master layout file that allows programs to have a single file that can share components such as: a navigation bar, login links, and other items that are required on multiple pages. In this guide we'll walk through the Rails master layout file and examine how we can customize it and therefore add elements that are shared across the application.
As helpful as the master application layout file is in Rails, we also have the ability to implement custom layout files in an application. This guide walks through how to build two custom layout files, one for our blog, and another for the portfolio pages.
Partials in Rails are a great way to share view components across multiple pages. Additionally, partials help make it possible to limit duplicate view code in an application. In this guide we'll walk through an introduction to Rails partials and refactor our navigation bar so that it can be shared across multiple layouts.
In addition to partials allowing applications to share view code, Rails also makes it possible to send data to partials in order to give them custom behavior. In this guide we'll examine how we can use locals in partials to refactor the Portfolio form and to add dynamic styles to the navigation bar.
View helpers are a great way to store view logic in a Rails application. In this guide we'll walk through: what view helpers are, how they can be used, how they are different from partials, and how to implement them in order to store the logic for our application's auth links.
So far we've covered the ability to hard code HTML code into a Rails view helper method. In this guide we'll walk through how to leverage the content_tag helper method to auto generate HTML code in a Rails 5 application.
This introductory guide walks through how to leverage partials to automatically render collections of data. We'll also walk through when this approach works and when you will need to manually configure the process.
In the last guide we implemented an automated way to render collections in a Rails view template. In this guide we'll examine how we can manually configure collections to work with partials.
This guide walks through how to implement powerful ActionView helper methods in a Rails application to perform tasks such as rendering how long ago a blog post was created, how auto render currency, and much more.
This deep dive examines various processes associated with ActionView. Specifically, we'll walk through: what ActionView is, how to manage views in a Rails application, how to work with partials, and much more.
devCamp does not support ancient browsers.
Install a modern version for best experience.