Exception: Graphiti::Errors::MissingRelationshipMethod

Inherits:
Base
  • Object
show all
Defined in:
lib/graphiti/errors.rb

Instance Method Summary collapse

Constructor Details

#initialize(resource_class, sideload, model) ⇒ MissingRelationshipMethod

Returns a new instance of MissingRelationshipMethod.



760
761
762
763
764
# File 'lib/graphiti/errors.rb', line 760

def initialize(resource_class, sideload, model)
  @resource_class = resource_class
  @sideload = sideload
  @model = model
end

Instance Method Details

#messageObject



766
767
768
769
770
771
772
773
# File 'lib/graphiti/errors.rb', line 766

def message
  <<~MSG
    #{@resource_class.name}: relationship #{@sideload.name.inspect} is declared, but #{@model.class.name} has no ##{@sideload.association_name} method.

    Rendering the relationship reads the association off the model. Define ##{@sideload.association_name} on #{@model.class.name}, point the relationship at the real association with `as:`, or remove the relationship.
    #{resource_ids_note}
  MSG
end