В Rails появился этот синтаксис throw(:abort)
, но как теперь получить осмысленные ошибки уничтожения?
Для ошибок проверки можно было бы сделать
if not user.save
# => user.errors has information
if not user.destroy
# => user.errors is empty
Вот моя модель
class User
before_destroy :destroy_validation,
if: :some_reason
private
def destroy_validation
throw(:abort) if some_condition
end