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

Undefined error when active job is included in other gem dependencies #309

Closed
ippachi opened this issue Jan 26, 2022 · 4 comments
Closed

Comments

@ippachi
Copy link
Contributor

ippachi commented Jan 26, 2022

First, thanks great gem 😄

I use this plugin without ActiveJob but that is included in ActiveSupport dependencies.
So Que::Scheduler::ToEnqueue.active_job_loaded? returns true, but ActiveJob is undefined because I don't require and I don't want to use ActiveJob.

My proposal

rename active_job_loaded? to active_job_defined? like below and replace to this.

def active_job_defined?
  Object.const_defined?('ActiveJob')
end

This change may break compatibility.

If you think this change is good, I'll create PR.

@hlascelles
Copy link
Owner

Thank you for the report! Sorry for the delay...

OK, I think I understand the issue. I will have a look very shortly and may come back with some questions. And may take you up on the offer of a PR :).

@hlascelles
Copy link
Owner

OK, yes, I see what you mean. It may mean the users in the future have to require "active_job" before this gem. If it crops up we can add some defensive messaging.

I think let's go with this change, yes please to a PR!

@ippachi
Copy link
Contributor Author

ippachi commented Feb 18, 2022

Thank you!
I'll try it this weekend 😄

@hlascelles
Copy link
Owner

Released! https://rubygems.org/gems/que-scheduler/versions/4.2.2

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

2 participants