O'Reilly logo

Crafting Rails 4 Applications, 2nd Edition by José Valim

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 3Retrieving View Templates from Custom Stores

  • How to customize the Rails rendering stack to look up templates from the database

  • How Ruby Hash lookup works

  • How to speed up controllers with ActionController::Metal

When Rails renders a template, it has to get that template from somewhere. By default, Rails serves templates from the filesystem, but it doesn’t need to be limited like that. Rails provides hooks that allow us to retrieve templates from anywhere we want, as long as we implement the required application programming interface (API). Let’s explore this by building a mechanism that lets us serve templates from a database—templates that can be created, updated, and deleted through the web interface. But first let’s take a deeper ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required