Class: GraphQL::Rails::ActiveReflection::Model
- Inherits:
-
Object
- Object
- GraphQL::Rails::ActiveReflection::Model
- Defined in:
- lib/graphql/rails/active_reflection.rb
Class Method Summary collapse
Class Method Details
.field(**kwargs, &block) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/graphql/rails/active_reflection.rb', line 23 def self.field(**kwargs, &block) # We have to define it fresh each time because # its name will be modified and its description # _may_ be modified. field = GraphQL::Field.define do type(GraphQL::Rails::ActiveReflection::Model.interface) description('Fetch the content model for the given object.') resolve(ModelReflection) end if kwargs.any? || block field = field.redefine(kwargs, &block) end field end |
.interface ⇒ Object
16 17 18 19 20 21 |
# File 'lib/graphql/rails/active_reflection.rb', line 16 def self.interface @interface ||= GraphQL::InterfaceType.define do name "ActiveReflectionInterface" field('_model', ModelReflectionType, 'Model of attributes for field.') end end |