Skip to content

Instantly share code, notes, and snippets.

@nikz
Created July 23, 2008 00:33
Show Gist options
  • Save nikz/1410 to your computer and use it in GitHub Desktop.
Save nikz/1410 to your computer and use it in GitHub Desktop.
def has_permission(name)
(p = permissions.detect{|p| p[:name] == name } ) ? p[:active] : false
end
def has_one_of_permissions(ps)
ps = [ps].flatten
ps.each do |p|
return true if has_permission(p)
end
false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment