Exception: Graphiti::Errors::PolymorphicSideloadTypeNotFound
- Defined in:
- lib/graphiti/errors.rb
Instance Method Summary collapse
-
#initialize(sideload, name) ⇒ PolymorphicSideloadTypeNotFound
constructor
A new instance of PolymorphicSideloadTypeNotFound.
- #message ⇒ Object
Constructor Details
#initialize(sideload, name) ⇒ PolymorphicSideloadTypeNotFound
Returns a new instance of PolymorphicSideloadTypeNotFound.
587 588 589 590 |
# File 'lib/graphiti/errors.rb', line 587 def initialize(sideload, name) @sideload = sideload @name = name end |
Instance Method Details
#message ⇒ Object
592 593 594 595 596 597 598 599 600 601 602 603 604 605 |
# File 'lib/graphiti/errors.rb', line 592 def <<~MSG #{@sideload.parent_resource}: Tried to find a Resource with type '#{@name.inspect}', but did not find one! This is because either a Resource with that type doesn't exist, or it's not registered on the sideload. The below example shows how to register a Resource with this sideload. Make sure one of the registered Resources has type '#{@name.inspect}' polymorphic_belongs_to #{@sideload.name.inspect} do group_by(#{@sideload.grouper.field_name.inspect}) do on(:foo) on(:foo).belongs_to :foo, resource: FooResource # (long-hand example) end end MSG end |