Exception: Petra::WriteClashError

Inherits:
ValueComparisonError show all
Defined in:
lib/petra/exceptions.rb

Overview

Thrown when an attribute that we previously read AND changed was also changed externally.

Instance Attribute Summary collapse

Attributes inherited from ValueComparisonError

#attribute, #external_value, #object

Instance Method Summary collapse

Methods inherited from ValueComparisonError

#continuable?, #ignore!

Methods inherited from HandlerException

#continuable?, #continue!, #reset_transaction!, #retry!, #rollback_transaction!

Methods inherited from ExtendedError

#initialize

Constructor Details

This class inherits a constructor from Petra::ExtendedError

Instance Attribute Details

#our_valueObject (readonly)

Returns the value of attribute our_value.



121
122
123
# File 'lib/petra/exceptions.rb', line 121

def our_value
  @our_value
end

Instance Method Details

#undo_changes!Object Also known as: use_theirs!

Tells the transaction to ignore all changes previously done to the current attribute in the transaction.



127
128
129
130
131
# File 'lib/petra/exceptions.rb', line 127

def undo_changes!
  Petra.current_transaction.current_section.log_attribute_change_veto(object,
                                                                      attribute:      attribute,
                                                                      external_value: external_value)
end