Using Rails 3 startup paths does not load some folders, but loads others

I use the autoload path in application.rb to load some additional modules and structures.

This is the following bit of code:

config.autoload_paths += %W(
  #{config.root}/app/controllers/concerns 
  #{config.root}/app/models/concerns 
  #{config.root}/app/jobs/
)

The funny thing is that both problem folders for extending models and controllers work fine.

However, the job folder does not load at all.

Is there anything special I need to do to download a folder in the application, or does anyone know why two of these folders are loading, and the third is not?

+5
source share
2 answers

Try removing the trailing slash after the jobs.

config.autoload_paths += %W(
  #{config.root}/app/controllers/concerns 
  #{config.root}/app/models/concerns 
  #{config.root}/app/jobs
)
+7
source

In any case, you do not need to explicitly load tasks.

http://hakunin.com/rails3-load-paths

0

All Articles