Exception: ViewModel::DeserializationError::InvalidAssociationType

Inherits:
InvalidRequest show all
Defined in:
lib/view_model/deserialization_error.rb

Overview

The target of an association was not a valid view type for that association.

Instance Attribute Summary collapse

Attributes inherited from AbstractErrorWithBlame

#nodes

Instance Method Summary collapse

Methods inherited from ViewModel::DeserializationError

#code

Methods inherited from AbstractError

#aggregation?, #causes, #code, #exception, #status, #title, #to_s, #view

Constructor Details

#initialize(association, target_type, node) ⇒ InvalidAssociationType

Returns a new instance of InvalidAssociationType.



150
151
152
153
154
# File 'lib/view_model/deserialization_error.rb', line 150

def initialize(association, target_type, node)
  @association = association
  @target_type = target_type
  super([node])
end

Instance Attribute Details

#associationObject (readonly)

Returns the value of attribute association.



148
149
150
# File 'lib/view_model/deserialization_error.rb', line 148

def association
  @association
end

#target_typeObject (readonly)

Returns the value of attribute target_type.



148
149
150
# File 'lib/view_model/deserialization_error.rb', line 148

def target_type
  @target_type
end

Instance Method Details

#detailObject



156
157
158
# File 'lib/view_model/deserialization_error.rb', line 156

def detail
  "Invalid target viewmodel type '#{target_type}' for association '#{association}'"
end

#metaObject



160
161
162
163
# File 'lib/view_model/deserialization_error.rb', line 160

def meta
  super.merge(association: association,
              target_type: target_type)
end