Class: Permission

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/permissable/permission.rb

Class Method Summary collapse

Class Method Details

.for_member(member) ⇒ Object



12
13
14
# File 'lib/permissable/permission.rb', line 12

def for_member(member)
  where(member)
end

.for_resource(resource) ⇒ Object



7
8
9
10
# File 'lib/permissable/permission.rb', line 7

def for_resource(resource)
  resource = Permissable.flatten_resource(resource)
  where(resource)
end

.with_permission_to(methods) ⇒ Object



16
17
18
# File 'lib/permissable/permission.rb', line 16

def with_permission_to(methods)
  where(:permission_type => [methods].flatten.uniq.collect{ |m| m.to_s.downcase })
end