Sha256: 7d8d7a3b773ce92760dde38f180481aa45c65fdebcc223bbf351f0d1fbce64c9

Contents?: true

Size: 596 Bytes

Versions: 2

Compression:

Stored size: 596 Bytes

Contents

# frozen_string_literal: true

module Ibrain
  module Types
    class BaseObject < GraphQL::Schema::Object
      include GraphQL::Relay::Node

      edge_type_class(Ibrain::Types::BaseEdge)
      connection_type_class(Ibrain::Types::BaseConnection)

      field_class ::Ibrain::Types::BaseField
      field :graphql_name, String, null: true

      def graphql_name
        object.class.try(:table_name)
      end

      protected

      def loader
        Ibrain::Loaders::AssociationLoader
      end

      def current_user
        context.try(:fetch, :current_user)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ibrain-core-0.5.6 app/graphql/ibrain/types/base_object.rb
ibrain-core-0.5.5 app/graphql/ibrain/types/base_object.rb