Protective is a small gem that protects your active records from being destroyed. Use it like
protect_if :members, "Record has members and cannot be destroyed"
This creates a before_destroy callback and adds the given message to the errors object of your record if the condition evaluates to #present?. Several callbacks may be declared. An additional method #protected? allows you to check beforehand.
gem install protective
Works for Active Record 2.3 and 3.0. Find the source at
https://github.com/codez/protective
Cheers
Pascal