Update: bitte Lauras siehe Antwort mit Active :: Dependencies.autoload_paths unten. Ich habe diese Antwort hier als alternative Methode hinterlassen.
In Rails::Engine
, die in der Rails-Anwendung des Moduls enthalten ist, gibt es die folgende Methode:
def _all_autoload_paths
@_all_autoload_paths ||= (config.autoload_paths + config.eager_load_paths + config.autoload_once_paths).uniq
end
ja, könnten Sie entweder tun:
(MyRailsApp::Application.config.autoload_paths + MyRailsApp::Application.config.eager_load_paths + MyRailsApp::Application.config.autoload_once_paths).uniq
oder:
[:autoload_paths, :eager_load_paths, :autoload_once_paths].collect{|m|MyRailsApp::Application.config.send(m)}.flatten.uniq
oder einfach:
MyRailsApp::Application._all_autoload_paths
Das Standarder in Rails 3.2.9 ist:
["/path/to/my_rails_app/app/assets", "/path/to/my_rails_app/app/controllers", "/path/to/my_rails_app/app/helpers", "/path/to/my_rails_app/app/mailers", "/path/to/my_rails_app/app/models"]
Dies sollte alle automatisch geladen Pfade enthält, die von anderen Edelsteinen und benutzerdefinierten Lastpfaden hinzugefügt wurde.
Arbeiten in Rails 5 sowie – dps