jondot / sneakers

A fast background processing framework for Ruby and RabbitMQ
https://github.com/jondot/sneakers
MIT License
2.24k stars 333 forks source link

Use Rails.autoloaders.zeitwerk_enabled? to check whether zeitwerk is rails autoloader #474

Closed thanosbellos closed 1 year ago

thanosbellos commented 1 year ago

In 472 there was a change on the way the rake tasks detects and use's Rails autoloader, by using Rails.application.config.autoloader method call. This works perfectly for projects with Rails version < 7. In Rails 7 projects this method call fails as it seems that Rails.application.config.autoloader is deprecated. Zeitwerk is the only autoloader available and is not configurable anymore. As per rails guides, there is a way to detect whether Zeitwerk autoloader is enabled, by using the predicate Rails.autoloaders.zeitwerk_enabled? which is still present at Rails 7.

michaelklishin commented 1 year ago

Thank you for the detailed problem description!