I've upgraded one of my apps from Rails 4.2.6 to Rails 5.0.0. The Upgrade Guide says, that the Autoload feature is now disabled in production by default.
Now I always get an error on my production server since I load all lib files with autoload in the application.rb
file.
module MyApp
class Application < Rails::Application
config.autoload_paths += %W( lib/ )
end
end
For now, I've set the config.enable_dependency_loading
to true
but I wonder if there is a better solution to this. There must be a reason that Autoloading is disabled in production by default.
lib
dir, one file is easily available in Runtime, but another has to be required manually :D – illusionistValidators
) in folders directly in the app/ directory since code there is auto loaded. – Tobiasapp/services/paylinx/paylinx_service.rb
Class definition:module Paylinx class PaylinxService end end
. I tried theseautoload_paths
stuff. doesn't work for me. – NamNamNam