Exception: ViewModel::DeserializationError::ReadOnlyAttribute

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

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) ⇒ ReadOnlyAttribute

Returns a new instance of ReadOnlyAttribute.



255
256
257
258
# File 'lib/view_model/deserialization_error.rb', line 255

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

Instance Attribute Details

#attributeObject (readonly)

Returns the value of attribute attribute.



253
254
255
# File 'lib/view_model/deserialization_error.rb', line 253

def attribute
  @attribute
end

Instance Method Details

#detailObject



260
261
262
# File 'lib/view_model/deserialization_error.rb', line 260

def detail
  "Cannot edit read only attribute '#{attribute}'"
end

#metaObject



264
265
266
# File 'lib/view_model/deserialization_error.rb', line 264

def meta
  super.merge(attribute: attribute)
end