Skip to content

Instantly share code, notes, and snippets.

@ahawkins
Created July 1, 2009 23:11
Show Gist options
  • Save ahawkins/139142 to your computer and use it in GitHub Desktop.
Save ahawkins/139142 to your computer and use it in GitHub Desktop.
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