Autoloading behavior change in Rails 6.1.3

Viewed 57

I have upgraded from Rails 6.0.3 to 6.1.3.

The new version does not seem to load files in app/lib, even though they were properly loaded before the upgrade.

Every documentation and StackOverflow question I found on the subject, states that app/lib/* should be auto loaded.

I have also tried adding these two in config/environments/development.rb without any change:

config.eager_load_paths << Rails.root.join('app/lib').to_s
config.autoload_paths << Rails.root.join('app/lib').to_s

My class is called GoodLogger, and it is placed in app/lib/good_logger.rb

I was unable to find anything in the changelog to indicate how to solve this.

I should mention that I need the loaded class to be available in the configuration file itself (config/environments/*.rb) and to highlight that this worked in 6.0.3.

So far, the only workaround I have found is to manually require the file prior to using it, but I know this is not the rails way.

Any help is appreciated.

0 Answers
Related