Exception: Graphiti::Errors::UnselectedForeignKey

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

Instance Method Summary collapse

Constructor Details

#initialize(resource_class, sideload, model) ⇒ UnselectedForeignKey

Returns a new instance of UnselectedForeignKey.



712
713
714
715
716
# File 'lib/graphiti/errors.rb', line 712

def initialize(resource_class, sideload, model)
  @resource_class = resource_class
  @sideload = sideload
  @model = model
end

Instance Method Details

#messageObject



718
719
720
721
722
723
724
# File 'lib/graphiti/errors.rb', line 718

def message
  <<~MSG
    #{@resource_class.name}: rendering resource linkage for relationship #{@sideload.name.inspect} reads ##{@sideload.foreign_key} off #{@model.class.name}, but that attribute is not loaded.

    Keep #{@sideload.foreign_key} in the selected columns, or turn linkage off with `resource_ids: false` on the relationship or `self.belongs_to_resource_ids_by_default = :never` on the resource.
  MSG
end