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

uninitialized constant DiscreteExecution #962

Closed
adzap opened this issue May 22, 2023 · 8 comments · Fixed by #963 or #983
Closed

uninitialized constant DiscreteExecution #962

adzap opened this issue May 22, 2023 · 8 comments · Fixed by #963 or #983

Comments

@adzap
Copy link

adzap commented May 22, 2023

Originating from method discrete_support? (app/models/good_job/base_execution.rb:38)` in v3.15.9

@bensheldon
Copy link
Owner

@adzap thanks for reporting this. I'm not sure why the constant lookup isn't working here, but I'll namespace it in GoodJob:: just to be sure:

if connection.table_exists?(DiscreteExecution.table_name)

@bensheldon
Copy link
Owner

@adzap
Copy link
Author

adzap commented May 22, 2023

Excellent, thanks.

I was going to say it might have something to do with zeitwerk but I see you removed it. I did have other const loading issues when I was first using the gem which I resolved myself with an explicit require.

@adzap
Copy link
Author

adzap commented Jun 16, 2023

Has there been a regression?

Here is the fix https://github.com/bensheldon/good_job/pull/963/files?

But here is the latest code

DiscreteExecution.migrated?

@bensheldon
Copy link
Owner

@adzap oops, sorry, that's my bad on the regression. That happened in #979 and it totally slipped my mind that the namespace was intentional.

I'll put it back and also put a custom Rubocop cop so it hopefully doesn't happen again.

@bensheldon bensheldon reopened this Jun 16, 2023
@bensheldon
Copy link
Owner

I did have other const loading issues when I was first using the gem which I resolved myself with an explicit require.

Re-reading through this, I imagine something is wrong in your application because it shouldn't be necessary to do any explicit requires with Rails and Rails's Zeitwerk loader.

Can you try running bin/rails zeitwerk:check?

@adzap
Copy link
Author

adzap commented Jun 16, 2023 via email

@adzap
Copy link
Author

adzap commented Jun 16, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment