Better Abstractions for HTML Views
This chapter will focus on classic, HTML-first Ruby on Rails applications and their data representation features, or, simply speaking, HTML views. First, we discuss built-in mechanisms for generating views in Rails, such as ERB templates and view helpers, and their drawbacks. Then, we consider an alternative approach to overcome these drawbacks and reduce the overall complexity of managing the HTML layer—view components.
We will cover the following topics:
- The V in Rails’ MVC: templates and helpers
- Thinking in components
The goal of this chapter is to demonstrate how object-oriented techniques can help you to keep the view layer organized and, thus, maintainable.