Created
July 1, 2009 23:11
-
-
Save ahawkins/139142 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module KeepUp | |
module Permissions | |
module Language | |
def method_missing(method_id, *attrs) | |
if /can_not_(.+)\?/.match(method_id.to_s) | |
return !has_permission?($~[1]) | |
elsif /can_(.+)\?/.match(method_id.to_s) | |
return has_permission?($~[1]) | |
#elsif /is_(.+)\?/.match(method_id.to_s) | |
#return true if has_permission? :god | |
#return !roles.find_by_name($~[1]).nil? | |
else | |
super | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment