asD
Ruby
code posted
created at 26 Oct 10:08, updated at 14 Nov 16:57
Edit
|
Back
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
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 |
408 Bytes in 3 ms with coderay