How View Caching in Rails Works (2020)
honeybadger.io·16h·
Discuss: Hacker News

Caching is a general term that means storing the result of some code so that we can quickly retrieve it later. This allows us to, for example, avoid hitting the database over and over to get data that rarely changes. Although the general concept is the same for all types of caching, Rails provides us with different aids depending on what we are trying to cache.

For Rails developers, common forms of caching include memoization, low-level caching (both covered in previous parts of this caching series), and view caching, which we will cover here.

How Ruby on Rails Renders Views

First, let’s cover some slightly confusing terminology. What the Rails community calls “views” are the files that live inside your app/views directory. Typically, these are .html.erb files, although t…

Similar Posts

Loading similar posts...