I have a Resource with attribute:
attribute :status, :atom do
constraints one_of: [:unseen, :incomplete, :complete]
default :unseen
end
I want to create an action:
update :incomplete do
change set_attribute(:status, :incomplete)
end
Except I want to validate that the current value of :status
isn’t :complete
, basically prevent improper state changes from one state to another from happening.
I looked at:
attribute_does_not_equal(attribute, value)
Validates that an attribute is not being changed to a specific value, or does not equal the given value if it is not being changed.
But as it says there, it only validates the current value of the attribute, IF it’s NOT being changed.