Module: HQ::GraphQL::ObjectAssociation
- Included in:
- Object
- Defined in:
- lib/hq/graphql/object_association.rb
Defined Under Namespace
Classes: ResourceReflection
Instance Method Summary
collapse
Instance Method Details
#belongs_to(name, scope = nil, **options, &block) ⇒ Object
30
31
32
|
# File 'lib/hq/graphql/object_association.rb', line 30
def belongs_to(name, scope = nil, **options, &block)
add_reflection(name, scope, options, :belongs_to, block)
end
|
#has_many(name, scope = nil, through: nil, **options, &block) ⇒ Object
34
35
36
37
|
# File 'lib/hq/graphql/object_association.rb', line 34
def has_many(name, scope = nil, through: nil, **options, &block)
raise TypeError, "has_many through is unsupported" if through
add_reflection(name, scope, options, :has_many, block)
end
|
#reflect_on_association(association) ⇒ Object
26
27
28
|
# File 'lib/hq/graphql/object_association.rb', line 26
def reflect_on_association(association)
resource_reflections[association.to_s]&.reflection(model_klass)
end
|