Skip to content
This repository was archived by the owner on Sep 24, 2019. It is now read-only.

Commit 715401b

Browse files
committed
Check if possible type in object from id
1 parent a195236 commit 715401b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

app/models/graph/schema.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ module Graph
1212

1313
object_from_id ->(id, query_ctx) do
1414
gid = GlobalID.parse(id)
15+
possible_types = query_ctx.warden.possible_types(GraphQL::Relay::Node.interface)
16+
17+
return unless possible_types.map(&:name).include?(gid.model_name)
18+
return unless gid.app == GlobalID.app
19+
1520
Object.const_get(gid.model_name).find(gid.model_id)
1621
end
1722
end

0 commit comments

Comments
 (0)