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.



272
273
274
275
# File 'lib/view_model/deserialization_error.rb', line 272

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

Instance Attribute Details

#attributeObject (readonly)

Returns the value of attribute attribute.



270
271
272
# File 'lib/view_model/deserialization_error.rb', line 270

def attribute
  @attribute
end

Instance Method Details

#detailObject



277
278
279
# File 'lib/view_model/deserialization_error.rb', line 277

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

#metaObject



281
282
283
# File 'lib/view_model/deserialization_error.rb', line 281

def meta
  super.merge(attribute: attribute)
end