Exception: Graphiti::Errors::PolymorphicSideloadChildNotFound

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

Instance Method Summary collapse

Constructor Details

#initialize(sideload, name) ⇒ PolymorphicSideloadChildNotFound

Returns a new instance of PolymorphicSideloadChildNotFound.



609
610
611
612
# File 'lib/graphiti/errors.rb', line 609

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

Instance Method Details

#messageObject



614
615
616
617
618
619
620
621
622
623
624
625
626
627
# File 'lib/graphiti/errors.rb', line 614

def message
  "    \#{@sideload.parent_resource}: Found record with \#{@sideload.grouper.field_name.inspect} == \#{@name.inspect}, which is not registered!\n\n    Register the behavior of different types like so:\n\n    polymorphic_belongs_to \#{@sideload.name.inspect} do\n      group_by(\#{@sideload.grouper.field_name.inspect}) do\n        on(\#{@name.to_sym.inspect}) <---- this is what's missing\n        on(:foo).belongs_to :foo, resource: FooResource (long-hand example)\n      end\n    end\n  MSG\nend\n"