How to list all autoload paths in Rails

Gary S. Weaver picture Gary S. Weaver · Nov 29, 2012 · Viewed 9.7k times · Source

How do you list all of the autoload paths in Rails?

In Rails console when I do this, it only lists the custom paths added to the config:

$ rails c
Loading development environment (Rails 3.2.9)
1.9.3p194 :001 > MyRailsApp::Application.config.autoload_paths
=> [] 

Answer

Laura Paakkinen picture Laura Paakkinen · Apr 7, 2016

You can access all the autoload paths through ActiveSupport::Dependencies.autoload_paths

Invoke it from console or run rails r 'puts ActiveSupport::Dependencies.autoload_paths' from command line.

More info here (For Rails 4, but it applies to Rails 3 as well): http://guides.rubyonrails.org/autoloading_and_reloading_constants.html#autoload-paths