Sha256: c3ff4e38bb953e5c51f0e0be33ac76738e93bfa6177c2f887db32edec84599e6

Contents?: true

Size: 761 Bytes

Versions: 7

Compression:

Stored size: 761 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

      def association_count_loader
        Ibrain::Loaders::AssociationCountLoader
      end

      def count_loader
        Ibrain::Loaders::CountLoader
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ibrain-core-0.5.15 app/graphql/ibrain/types/base_object.rb
ibrain-core-0.5.13 app/graphql/ibrain/types/base_object.rb
ibrain-core-0.5.12 app/graphql/ibrain/types/base_object.rb
ibrain-core-0.5.10 app/graphql/ibrain/types/base_object.rb
ibrain-core-0.5.9 app/graphql/ibrain/types/base_object.rb
ibrain-core-0.5.8 app/graphql/ibrain/types/base_object.rb
ibrain-core-0.5.7 app/graphql/ibrain/types/base_object.rb