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
parent c9752e94be
commit b36fdb5604
3 changed files with 15 additions and 0 deletions

View File

@@ -10,6 +10,11 @@ Rails.application.configure do
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Because autoloading is disabled in production environments 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.
config.eager_load_paths << "#{config.root}/lib"
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true

View File

@@ -10,6 +10,11 @@ Rails.application.configure do
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Because autoloading is disabled in production environments 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.
config.eager_load_paths << "#{config.root}/lib"
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true

View File

@@ -10,6 +10,11 @@ Rails.application.configure do
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Because autoloading is disabled in production environments 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.
config.eager_load_paths << "#{config.root}/lib"
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true