I'm creating a set of classes that depend on them being required() in a specific order because I'm using the class method #inherited on the parent.
Since rails only attempts to开发者_运维技巧 load classes when they are first used, the #inherited method of the parent class is only loaded sometimes and not always.
Is it possible to eager load this classes in a rails way? or should I just place them in another directory and call 'require'?
You can take advantage of the config.eager_load_paths
attribute that you can set in your environments/(development|production).rb file.
config.eager_load_paths accepts an array of paths from which Rails will eager load on boot if cache classes is enabled. Defaults to every folder in the app directory of the application. All elements of this array must also be in load_paths.
from here
精彩评论