Class: GraphQL::SmartSelect::Assosiations

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/smart_select/assosiations.rb

Overview

Provide methods to expose foreign keys for belongs_to and has_one assosiations

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(relation, query_fields) ⇒ Assosiations

Returns a new instance of Assosiations.



12
13
14
15
# File 'lib/graphql/smart_select/assosiations.rb', line 12

def initialize(relation, query_fields)
  @relation = relation
  @query_fields = query_fields
end

Instance Attribute Details

#query_fieldsObject (readonly)

Returns the value of attribute query_fields.



10
11
12
# File 'lib/graphql/smart_select/assosiations.rb', line 10

def query_fields
  @query_fields
end

#relationObject (readonly)

Returns the value of attribute relation.



10
11
12
# File 'lib/graphql/smart_select/assosiations.rb', line 10

def relation
  @relation
end

Instance Method Details

#exposeObject



17
18
19
# File 'lib/graphql/smart_select/assosiations.rb', line 17

def expose
  assosiations_keys
end