Rolling is a minimalist gem the handle scoped role without any dependency.
Add this line to your application's Gemfile:
gem 'rolling'And then execute:
$ bundle
Or install it yourself as:
$ gem install rolling
class User
include Rolling.new(:admin, :user, :moderator).scope(Forum)
include Rolling.new(:admin).scope(:backend)
include Rolling.new(:user)
end user = User.new
user.roles[Forum] << :admin
user.roles.is_admin? #=> false
user.roles[Forum].is_admin? #=> true
user.roles << :user
user.roles.is_user? #=> true
user.roles[Forum].is_user? # => true
user.roles[Forum].is?(:user, :admin) #=> true - yes, this is a and
user.roles[Forum].has?(:user, :moderator) #=> true - yes, this is a or.- Fork it ( https://github.com/[my-github-username]/rolling/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request