on before_create, before_update, before_destroy methods, I would like to do an if: on multiple constraints, such as
before_destroy :lock_quantity, if: [:processed, :quantity_changed]
so that if it’s been processed, the quantity cant change
(just in case:)
def lock_quantity
errors.add :quantity, "You must revert the row before changing quantity"
end
so, is it possible to have multiple conditions for if:
?
So, this should actually be like this…
Notice the question mark!
(just in case:)
pass false to stop saving