Exception: Graphiti::Errors::InvalidBelongsToResourceIds

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

Instance Method Summary collapse

Constructor Details

#initialize(resource_class, value) ⇒ InvalidBelongsToResourceIds

Returns a new instance of InvalidBelongsToResourceIds.



693
694
695
696
# File 'lib/graphiti/errors.rb', line 693

def initialize(resource_class, value)
  @resource_class = resource_class
  @value = value
end

Instance Method Details

#messageObject



698
699
700
701
702
703
704
705
706
707
708
# File 'lib/graphiti/errors.rb', line 698

def message
  <<~MSG
    #{@resource_class.name}: belongs_to_resource_ids_by_default must be one of :foreign_key, :always, or :never. Got #{@value.inspect}.

      :foreign_key - render resource ids wherever the foreign key already holds the related id (default)
      :always      - render them for every belongs_to, loading the association when the foreign key cannot answer
      :never       - render none

    To render resource ids for a collection, ask for it one relationship at a time with `resource_ids: true`.
  MSG
end