-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move ActiveRecord::FixtureSet.signed_global_id to this gem
Active Record doesn't depend on GlobalID so this code should not be defined there. Instead, we should use the `active_record_fixture_set` `on_load` hook to define the GlobalID specific method using the GlobalID railtie.
- Loading branch information
1 parent
e9d6ed9
commit b3ec8b9
Showing
2 changed files
with
18 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
class GlobalID | ||
module FixtureSet | ||
def signed_global_id(fixture_set_name, label, column_type: :integer, **options) | ||
identifier = identify(label, column_type) | ||
model_name = default_fixture_model_name(fixture_set_name) | ||
uri = URI::GID.build([GlobalID.app, model_name, identifier, {}]) | ||
|
||
SignedGlobalID.new(uri, **options) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters