Class: GraphQL::Sources::ActiveRecordBase

Inherits:
Dataloader::Source
  • Object
show all
Defined in:
lib/graphql/sources/active_record_base.rb

Overview

An abstract class for interacting with active record.

Instance Method Summary collapse

Constructor Details

#initialize(model, key:) ⇒ ActiveRecordBase

Returns a new instance of ActiveRecordBase.

Parameters:

  • model (Class)

    a child class of ActiveRecord::Base (e.g. Comment)

  • key (Symbol)

    an attribute (typically a foreign key) to use for loading (e.g. :user_id)



9
10
11
12
13
# File 'lib/graphql/sources/active_record_base.rb', line 9

def initialize(model, key:)
  super()
  @model = model
  @key = key
end