简体   繁体   中英

Rails autoload_paths doesn't work properly in rails console

I've created components folder in the root of rails 5 project and added it to autoload_paths like below:

In config/application.rb:

config.autoload_paths += %W(#{config.root}/components)
config.eager_load_paths += %W(#{config.root}/components)

But the files inside components doesn't load when I tested in rails console. I guess this is something related to cache issue... Any ideas ?

Did you set eager_load as true in environment config ?

For example, in config/environments/development.rb:

config.eager_load = true

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM