Module: GraphqlRails::Decorator

Extended by:
ActiveSupport::Concern
Defined in:
lib/graphql_rails/decorator.rb,
lib/graphql_rails/decorator/relation_decorator.rb

Overview

adds ‘.decorate` class method to any class. Handy when using with paginated responses

usage: class FriendDecorator < SimpleDecorator

include GraphqlRails::Decorator

graphql.attribute :full_name

end

class User

has_many :friends
graphql.attribute :decorated_friends, paginated: true, type: 'FriendDecorator!'

def decorated_friends
  FriendDecorator.decorate(friends)
end

end

Defined Under Namespace

Classes: RelationDecorator