rails将自动加载该配置下定义的所有常量,默认加载app下的所有目录
config.autoload_paths 是一个Array的实例
使用方式:
config.autoload_paths += %W(#{config.root}/lib/puff)
说明:
config.autoload_paths accepts an array of paths from which
Rails will autoload constants. Default is all directories under app.
当config.eager_load = true的时才会立即加载
使用方式:
config.eager_load_paths += %W(#{config.root}/lib/apple)
说明:
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
当开启config.eager_load = true的时候 eager_load_paths中的会立即加载执行require
而autoload_paths不会