現象
appの下にservicesというディレクトリを置いてもロードされず、NameError: uninitialized constant
でクラスが読めません。
環境
- Ruby 2.3.3
- Rails 5.0.1
結論
Springを一度停止したところloadされるようになりました。
Before
server git:(master) ➜ bin/rails runner 'puts ActiveSupport::Dependencies.autoload_paths'
Running via Spring preloader in process 54908
/Users/y1row/src/github.com/app/server/app/assets
/Users/y1row/src/github.com/app/server/app/channels
/Users/y1row/src/github.com/app/server/app/controllers
/Users/y1row/src/github.com/app/server/app/controllers/concerns
/Users/y1row/src/github.com/app/server/app/helpers
/Users/y1row/src/github.com/app/server/app/jobs
/Users/y1row/src/github.com/app/server/app/mailers
/Users/y1row/src/github.com/app/server/app/models
/Users/y1row/src/github.com/app/server/app/models/concerns
/Users/y1row/src/github.com/app/server/app/serializers
Spring停止
server git:(master) ➜ bin/spring stop
Spring stopped.
After
server git:(master) ➜ bin/rails runner 'puts ActiveSupport::Dependencies.autoload_paths'
Running via Spring preloader in process 54986
/Users/y1row/src/github.com/app/server/app/assets
/Users/y1row/src/github.com/app/server/app/channels
/Users/y1row/src/github.com/app/server/app/controllers
/Users/y1row/src/github.com/app/server/app/controllers/concerns
/Users/y1row/src/github.com/app/server/app/helpers
/Users/y1row/src/github.com/app/server/app/jobs
/Users/y1row/src/github.com/app/server/app/mailers
/Users/y1row/src/github.com/app/server/app/models
/Users/y1row/src/github.com/app/server/app/models/concerns
/Users/y1row/src/github.com/app/server/app/serializers
/Users/y1row/src/github.com/app/server/app/services ←増えた