Exception: Graphiti::Errors::PolymorphicSideloadTypeNotFound

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

Instance Method Summary collapse

Constructor Details

#initialize(sideload, name) ⇒ PolymorphicSideloadTypeNotFound

Returns a new instance of PolymorphicSideloadTypeNotFound.



573
574
575
576
# File 'lib/graphiti/errors.rb', line 573

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

Instance Method Details

#messageObject



578
579
580
581
582
583
584
585
586
587
588
589
590
591
# File 'lib/graphiti/errors.rb', line 578

def message
  "    \#{@sideload.parent_resource}: Tried to find a Resource with type '\#{@name.inspect}', but did not find one!\n\n    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}'\n\n    polymorphic_belongs_to \#{@sideload.name.inspect} do\n      group_by(\#{@sideload.grouper.field_name.inspect}) do\n        on(:foo)\n        on(:foo).belongs_to :foo, resource: FooResource # (long-hand example)\n      end\n    end\n  MSG\nend\n"