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.



744
745
746
747
748
# File 'lib/graphiti/errors.rb', line 744

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

Instance Method Details

#messageObject



750
751
752
753
754
755
756
# File 'lib/graphiti/errors.rb', line 750

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