Class: ActiveGraphql::Model::BuildOrRelation

Inherits:
Object
  • Object
show all
Defined in:
lib/active_graphql/model/build_or_relation.rb

Overview

reformats action to default format which very opinionated and based in following assumptions:

  • all attributes and fields are camel cased

  • all mutation actions accept one or two fields: id and input (input is everyting except ‘id’)

  • collection actions are paginated and accepts input attribute ‘filter`

github graphql structure was used as inspiration

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(left_scope, right_scope) ⇒ BuildOrRelation

Returns a new instance of BuildOrRelation.



16
17
18
19
# File 'lib/active_graphql/model/build_or_relation.rb', line 16

def initialize(left_scope, right_scope)
  @left_scope = left_scope
  @right_scope = right_scope
end

Class Method Details

.call(*args) ⇒ Object



12
13
14
# File 'lib/active_graphql/model/build_or_relation.rb', line 12

def self.call(*args)
  new(*args).call
end

Instance Method Details

#callObject



21
22
23
# File 'lib/active_graphql/model/build_or_relation.rb', line 21

def call
  shared_scope.where(or: or_attributes)
end