Exception: ViewModel::DeserializationError::UnknownAttribute

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

Overview

A view included an unknown attribute

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(attribute, node) ⇒ UnknownAttribute

Returns a new instance of UnknownAttribute.



109
110
111
112
# File 'lib/view_model/deserialization_error.rb', line 109

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

Instance Attribute Details

#attributeObject (readonly)

Returns the value of attribute attribute.



107
108
109
# File 'lib/view_model/deserialization_error.rb', line 107

def attribute
  @attribute
end

Instance Method Details

#detailObject



114
115
116
# File 'lib/view_model/deserialization_error.rb', line 114

def detail
  "Unknown attribute/association #{attribute} in viewmodel '#{viewmodel_class.view_name}'"
end

#metaObject



118
119
120
# File 'lib/view_model/deserialization_error.rb', line 118

def meta
  super.merge(attribute: attribute)
end