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.



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

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.



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

def association
  @association
end

#target_typeObject (readonly)

Returns the value of attribute target_type.



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

def target_type
  @target_type
end

Instance Method Details

#detailObject



154
155
156
# File 'lib/view_model/deserialization_error.rb', line 154

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

#metaObject



158
159
160
161
# File 'lib/view_model/deserialization_error.rb', line 158

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