Once way you can do this is by adding the following to one of the files in config/initializers
require 'core_ext/array`
All your autoload_paths
config value does is make the paths available for when the classes/files are requested. In my app I might have some file structure as follows
- lib/
|
|- deefour.rb
|- deefour/
|
|- core_ext.rb
In my deefour.rb
I have
require 'deefour/core_ext'
and inside config/initializers
I have a deefour.rb
file containing simply
require 'deefour'
The only way the autoload config value you set will cause Rails to look auto load lib/deefour/core_ext.rb
is if you had some call to a class Deefour::CoreExt
that existed in that file. This is why my require 'deefour'
line in the initializer knows to autoload the lib/deefour.rb
file.
The explicit require 'deefour/core_ext'
in lib/deefour.rb
serves the same purpose, since it too does not follow the standard class-name-to-directory mapping Ruby/Rails will expect.