Module: Permissable
- Defined in:
- lib/permissable.rb,
lib/permissable/member.rb,
lib/permissable/resource.rb,
lib/permissable/permissions_cache.rb
Defined Under Namespace
Modules: ClassMethods, Member, Resource Classes: PermissableError, PermissionNotDefined, PermissionsCache, ResourceNotPermissable
Class Method Summary collapse
-
.flatten_resource(obj) ⇒ Object
Creates a hash from a resource to be used in a where context.
- .included(base) ⇒ Object
Class Method Details
.flatten_resource(obj) ⇒ Object
Creates a hash from a resource to be used in a where context.
29 30 31 32 |
# File 'lib/permissable.rb', line 29 def flatten_resource(obj) return { :resource_id => obj.id, :resource_type => (obj.respond_to?(:base_class) ? obj.base_class.to_s : obj.class.base_class.to_s) } unless obj.is_a?(Array) { :resource_id => obj.collect{ |o| o.id }, :resource_type => obj.collect{ |o| (o.respond_to?(:base_class) ? o.base_class.to_s : o.class.base_class.to_s) } } end |
.included(base) ⇒ Object
24 25 26 |
# File 'lib/permissable.rb', line 24 def included(base) base.extend ClassMethods end |