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.



712
713
714
715
716
# File 'lib/graphiti/errors.rb', line 712

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

Instance Method Details

#messageObject



718
719
720
721
722
723
724
725
# File 'lib/graphiti/errors.rb', line 718

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