Add lib folder path to eager_load_paths

Because autoloading is disabled in production with Rails 5,
using autoload_paths will not load needed classes from
specified paths. The solution to this, is to ask Rails
to eager load classes.

https://sipsandbits.com/2017/02/14/upgrading-a-ruby-on-rails-application/
This commit is contained in:
Julian Herrero
2019-04-04 16:48:32 +02:00
committed by voodoorai2000
parent 08d7863bb5
commit 2ba7355b00
3 changed files with 3 additions and 3 deletions

View File

@@ -13,7 +13,7 @@ Rails.application.configure do
# Because autoloading is disabled in production environments with Rails 5, # Because autoloading is disabled in production environments with Rails 5,
# using autoload_paths will not load needed classes from specified paths. # using autoload_paths will not load needed classes from specified paths.
# The solution to this, is to ask Rails to eager load classes. # The solution to this, is to ask Rails to eager load classes.
config.eager_load_paths << "#{config.root}/lib" config.eager_load_paths += ["#{config.root}/lib"]
# Full error reports are disabled and caching is turned on. # Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false config.consider_all_requests_local = false

View File

@@ -13,7 +13,7 @@ Rails.application.configure do
# Because autoloading is disabled in production environments with Rails 5, # Because autoloading is disabled in production environments with Rails 5,
# using autoload_paths will not load needed classes from specified paths. # using autoload_paths will not load needed classes from specified paths.
# The solution to this, is to ask Rails to eager load classes. # The solution to this, is to ask Rails to eager load classes.
config.eager_load_paths << "#{config.root}/lib" config.eager_load_paths += ["#{config.root}/lib"]
# Full error reports are disabled and caching is turned on. # Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false config.consider_all_requests_local = false

View File

@@ -13,7 +13,7 @@ Rails.application.configure do
# Because autoloading is disabled in production environments with Rails 5, # Because autoloading is disabled in production environments with Rails 5,
# using autoload_paths will not load needed classes from specified paths. # using autoload_paths will not load needed classes from specified paths.
# The solution to this, is to ask Rails to eager load classes. # The solution to this, is to ask Rails to eager load classes.
config.eager_load_paths << "#{config.root}/lib" config.eager_load_paths += ["#{config.root}/lib"]
# Full error reports are disabled and caching is turned on. # Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false config.consider_all_requests_local = false