November 2013
Intermediate to advanced
200 pages
4h 31m
English
To understand why we need to explicitly turn on allow_concurrency, we need to analyze the mechanisms available in Ruby and Rails to load code.
The most common form of loading code is Ruby’s require method:
| | require "live_assets" |
Some libraries work fine by simply using require, but as they grow, some of them tend to rely on autoload techniques to avoid loading all their files up front. Autoload is particularly important in Rails plug-ins because it helps application boot time to stay low in development and test environments, since we load modules only when we first need them.
We’ve used Ruby’s autoload in this chapter with the LiveAssets::SSESubscriber class:
| | module LiveAssets |
| | autoload :SSESubscriber, ... |