Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialization autoloaded the constants Deprecation #707

Open
joshuacronemeyer opened this issue Mar 18, 2021 · 0 comments
Open

Initialization autoloaded the constants Deprecation #707

joshuacronemeyer opened this issue Mar 18, 2021 · 0 comments

Comments

@joshuacronemeyer
Copy link

Hi there,

I'm hoping for some advice/best practice. My understanding is that people commonly load the schedule in an initializer, something like Resque.schedule = yaml_schedule We've just upgraded to Rails 6 and switched to zeitwerk for loading and we're cleaning up the warnings about autoloading of classes no longer happening at initialization. For every job class that we're scheduling I now need to require it and all it's dependencies manually. It's a lot of classes and seems fiddly as classes are added and removed from the scheduler over time.

One other approach from manually loading everything in my initializer is to put the Resque.schedule call into an autoloader callback. This means that when a file changes rails could call that again. Will that create issues? https://guides.rubyonrails.org/autoloading_and_reloading_constants.html#autoloading-when-the-application-boots

Thanks in advance for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant