Skip to content

Commit 3ec5161

Browse files
committed
allow AR::Base objects in Shard.*_id_for stubs
test-plan: - specs pass Change-Id: I6fd8e53fe9c22a00fdf74f6a9860b0adbda0018d Reviewed-on: https://gerrit.instructure.com/22546 Reviewed-by: Cody Cutrer <cody@instructure.com> Tested-by: Jenkins <jenkins@instructure.com> Product-Review: Jacob Fugal <jacob@instructure.com> QA-Review: Jacob Fugal <jacob@instructure.com>
1 parent a4a2143 commit 3ec5161

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/stubs/shard.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ def relative_id_for(any_id, target_shard = nil)
6767
end
6868

6969
def self.global_id_for(any_id)
70-
any_id
70+
any_id.is_a?(ActiveRecord::Base) ? any_id.global_id : any_id
7171
end
7272

7373
def self.relative_id_for(any_id, target_shard = nil)
74-
any_id
74+
any_id.is_a?(ActiveRecord::Base) ? any_id.local_id : any_id
7575
end
7676

7777
yaml_as "tag:instructure.com,2012:Shard"

0 commit comments

Comments
 (0)