mongoid-simple-roles
Very basic and simple roles system for mongoid v3. HEAVILY INSPIRED by mongoid-simple-tags
Install
Add the following to Gemfile:
gem "mongoid-simple-roles", "0.0.1"
Usage
Model
ruby
class User
include Mongoid::Document
include Mongoid::Document::Roleable
end
Console
```ruby u = User.create(:name => “Drefined”, with_roles: [‘superadmin’, ‘admin’, ‘user’])
u.roles # => [‘superadmin’, ‘admin’, ‘user’]
User.find_roles(‘superadmin’) # => u
u2 = User.new(:name => “Quicksorter”) u2.add_role = ‘admin’ u2.save
User.find_roles(‘admin’) # => [u, u2] ```
Questions or Problems?
If you have any issue or feature request with/for rolify, please add an issue on GitHub or fork the project and send a pull request.