def protect_if(method, message = nil)
      unless self < InstanceMethods
        class_attribute :protect_if_methods
        self.protect_if_methods = {}

        before_destroy :destruction_allowed?
        send :include, InstanceMethods
      end

      protect_if_methods[method] = message
    end
def protect_if(method, message = nil)
      unless self < InstanceMethods
        class_attribute :protect_if_methods
        self.protect_if_methods = {}

        before_destroy :destruction_allowed?
        send :include, InstanceMethods
      end

      protect_if_methods[method] = message
    end
Protects a record from being destroyed if the passed method
 evaluates to #present? upon destruction. If a messag is given,
 it is added to the corresponding #errors object.