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

Resolve GlobalID::Locator.locate missing argument warning #435

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

salimepoint
Copy link

Add in an (unused) options arg for the TestLocator.locate method to resolve the following deprecation warning thrown by Rails 7.1 when running the test suite:

DEPRECATION WARNING: It seems your locator is defining the `locate` method only with one argument. 
Please make sure your locator is receiving the options argument as well, like `locate(gid, options = {})`. 
(called from run at /work/lib/que/active_job/extensions.rb:138)

Another option would be

      def locate(*args)
        args[0].then { |gid| gid.model_name.constantize.find(gid.model_id) }
      end

but as the earliest versions of the base GlobalID::Locator.locate method have the options = {} second argument I think what's in the PR should be fine regardless of the underlying Rails version?

Add in an (unused) options arg for the TestLocator locate method to resolve the following deprecation warning thrown by Rails 7.1 when running the test suite:

DEPRECATION WARNING: It seems your locator is defining the `locate` method only with one argument. Please make sure your locator is receiving the options argument as well, like `locate(gid, options = {})`. (called from run at /work/lib/que/active_job/extensions.rb:138)
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

Successfully merging this pull request may close these issues.

1 participant