Skip to content

fix: implement GlobalID locator model_class#317

Open
FrancescoK wants to merge 1 commit into
basecamp:mainfrom
FrancescoK:main
Open

fix: implement GlobalID locator model_class#317
FrancescoK wants to merge 1 commit into
basecamp:mainfrom
FrancescoK:main

Conversation

@FrancescoK

@FrancescoK FrancescoK commented Jun 29, 2026

Copy link
Copy Markdown

Version 1.4 of the globalid gem now requires a #model_class method and surfaces deprecation warnings if missing. This commit addresses that in a narrow fashion. A version inheriting from GlobalID’s BaseLocator class is in #318 instead.

Copilot AI review requested due to automatic review settings June 29, 2026 10:31

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates ActiveRecord::Tenanted::GlobalId::Locator to comply with the GlobalID 1.4 requirement for a #model_class method, avoiding deprecation warnings and keeping locator behavior consistent with tenant-safety checks.

Changes:

  • Add ActiveRecord::Tenanted::GlobalId::Locator#model_class and route locate through it.
  • Update tenant context safety checks to use the locator’s resolved model class.
  • Add a unit test asserting #model_class returns the expected model constant.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
lib/active_record/tenanted/global_id.rb Introduces #model_class and refactors locate/tenant safety logic to use it.
test/unit/global_id_test.rb Adds coverage for the new #model_class behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/active_record/tenanted/global_id.rb
Version 1.4 of the globalid gem now requires a #model_class method and surfaces deprecation warnings if missing. This commit addresses that.
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.

2 participants