Title / Description
Code module SecurityGuard class DestroyForbidden < RuntimeError; end def destroy message = if [Payment, Game].include? self.class "#{self.class} instances could not be destroyed" elsif [Quest].include?(self.class) && self.games.any? "Quest instances with active games could not be destroyed" end raise DestroyForbidden.new(message) if message super end end
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code