Closed leemour closed 1 year ago
@palkan hey!
I think the problem is, Zeitwerk gem can be plugged in the application like a third party dependency, and at the same time not used by the Rails app as main loader. It looks like we need to add zeitwerk
gem into this file https://github.com/palkan/anyway_config/blob/master/gemfiles/rails5.gemfile to represent the bug.
Maybe we should check the Rails version too?https://github.com/palkan/anyway_config/blob/8f4e3f5fb8e0320a7c9300bbb402005781b89292/lib/anyway/rails/settings.rb#L15
@bibendi Thanks!
Yeah, adding Zeitwerk to a Gemfile reproduces the problem: https://github.com/palkan/anyway_config/actions/runs/4858358580/jobs/8659695489
Will take a closer look soon.
Pushed a fix to master.
We should be able to use Zeitwerk even if Rails app is not using it; we just should check for Rails inflectors.
Also, added an internal option Anyway::Settings.autoload_via_zeitwerk = true | false
that can be used to manually control autoloaders behavior.
Please, let me know if the fix doesn't help, I'll re-open the issue.
Thanx for fix!
I am linking it here:
When would you build next gem release (2.4.1)?
2.4.1 is out!
What did you do?
Start application
rails s
orrails c
What did you expect to happen?
Application loaded without errors
What actually happened?
Error occured
Additional context
Created a config .rb, .yml files. Seems like Rails::Autoloaders doesn't exist in railties 5.1.7
Environment
Ruby Version: 2.7.7
Framework Version (Rails, whatever): 5.1.7
Anyway Config Version: Tried version 2.3.1, 2.4.0