Exception: Graphiti::Errors::AssignedModelNotSupported

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

Instance Method Summary collapse

Constructor Details

#initialize(resource_class, method_name) ⇒ AssignedModelNotSupported

Returns a new instance of AssignedModelNotSupported.



88
89
90
91
# File 'lib/graphiti/errors.rb', line 88

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

Instance Method Details

#messageObject



93
94
95
96
97
98
99
100
101
102
103
# File 'lib/graphiti/errors.rb', line 93

def message
  <<~MSG
    #{@resource_class}: the model was already assigned via #assign_attributes (or #data before save), but ##{@method_name} is overridden without a parameter to receive it, so changes made to the unsaved model would be silently lost.

    Accept and use the assigned model in your override:

      def #{@method_name}(attributes, meta = nil, assigned_model: nil)

    or persist with #save alone, without inspecting the model first. See UPGRADING.md.
  MSG
end