Why would you want to return false from a callback and still destroy it? I think you might try to squeeze two different concepts into a single method definition: if you want to check whether or not price is lower than something and actually USE that information somewhere else, then just create another method “low_price?”, and you can use it in “low_price” callback:
def low_price
if low_price?
# do something before the record is destroyed
end
true
end
def low_price?
price <= 100
end
Thanks for your answer. See my comments below
Why would you want to return false from a callback and still destroy it?
No. I do not want. I think you missed the point of my post. In the example that I have written the Order Item IS NOT CORRECTLY deleted, because it has high price. The PROBLEM is that the OWNING Order is deleted, when it shouldn’t.
Please, consider this as an example of an owner (Order in the example) being deleted when it shouldn’t (because of the fact that the owned item (Order Item in the example) is not deleted). Do not stick too much on the business value of the example.
There may not be much, if any.
Panayotis