Module: GraphQL::Types::Relay::HasNodeField
- Defined in:
- lib/graphql/types/relay/has_node_field.rb
Overview
Include this module to your root Query type to get a Relay-compliant node(id: ID!): Node field that uses the schema’s object_from_id hook.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.field_block ⇒ Object
28 29 30 31 32 33 |
# File 'lib/graphql/types/relay/has_node_field.rb', line 28 def field_block Proc.new { argument :id, "ID!", description: "ID of the object." } end |
Instance Method Details
#get_relay_node(id:) ⇒ Object
12 13 14 |
# File 'lib/graphql/types/relay/has_node_field.rb', line 12 def get_relay_node(id:) context.schema.object_from_id(id, context) end |