Module: MuchRails::Records::ValidateDestroy

Includes:
MuchMixin
Defined in:
lib/much-rails/records/validate_destroy.rb

Overview

MuchRails::Records::ValidateDestroy is used to mix in custom validation logic and handling in destroying records.

Include this module and define the #validate_destroy private method. Any calls to #destroy or #destroy! will first check if the record is #destroyable?. This check runs the custom #validate_destroy logic. If the record is not destroyable, the #validate_destroy method should add #destruction_error_messages.