What is the best way, to check that a model relationship is in use in another model to prevent it from being destroyed thus creating an orphan.
Example: I have a Ticket and TicketStatus models. TicketStatus belongs to Ticket. Ticket has_many TicketStatuses.
I should not be able to delete a TicketStatus if it is already assigned to a Ticket. I would like an error message as well.
Easiest ways a callback:
This prevents it and gives you an error.
Hope this helps!