Exception: Statecraft::DirtyRecordError

Inherits:
Error
  • Object
show all
Defined in:
lib/statecraft/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(record:, changed_attributes:) ⇒ DirtyRecordError

Returns a new instance of DirtyRecordError.



84
85
86
87
88
89
# File 'lib/statecraft/errors.rb', line 84

def initialize(record:, changed_attributes:)
  @record = record
  @changed_attributes = changed_attributes
  super("cannot lock-transition #{record.class.name}##{record.id} with unsaved changes " \
        "(#{changed_attributes.join(", ")}): save or reload before transitioning")
end

Instance Attribute Details

#changed_attributesObject (readonly)

Returns the value of attribute changed_attributes.



82
83
84
# File 'lib/statecraft/errors.rb', line 82

def changed_attributes
  @changed_attributes
end

#recordObject (readonly)

Returns the value of attribute record.



82
83
84
# File 'lib/statecraft/errors.rb', line 82

def record
  @record
end