Exception: Graphiti::Errors::SingularSideload

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

Instance Method Summary collapse

Constructor Details

#initialize(sideload, parent_length) ⇒ SingularSideload

Returns a new instance of SingularSideload.



90
91
92
93
# File 'lib/graphiti/errors.rb', line 90

def initialize(sideload, parent_length)
  @sideload = sideload
  @parent_length = parent_length
end

Instance Method Details

#messageObject



95
96
97
98
99
100
101
102
103
104
105
# File 'lib/graphiti/errors.rb', line 95

def message
  <<-MSG
    #{@sideload.parent_resource.class.name}: tried to sideload #{@sideload.name.inspect}, but more than one #{@sideload.parent_resource.model.name} was passed!

    This is because you marked the sideload #{@sideload.name.inspect} with single: true

    You might have done this because the sideload can only be loaded from a :show endpoint, and :index would be too expensive.

    Remove the single: true option to bypass this error.
  MSG
end