README.md in rolify-5.2.0 vs README.md in rolify-5.3.0

- old
+ new

@@ -1,6 +1,6 @@ -# rolify [![Gem Version](https://badge.fury.io/rb/rolify.svg)](http://badge.fury.io/rb/rolify) [![build status](https://secure.travis-ci.org/RolifyCommunity/rolify.png)](http://travis-ci.org/RolifyCommunity/rolify) [![Dependency Status](https://gemnasium.com/RolifyCommunity/rolify.svg)](https://gemnasium.com/RolifyCommunity/rolify) [![Code Climate](https://codeclimate.com/github/RolifyCommunity/rolify.png)](https://codeclimate.com/github/RolifyCommunity/rolify) [![Coverage Status](https://coveralls.io/repos/RolifyCommunity/rolify/badge.svg?branch=master&service=github)](https://coveralls.io/github/RolifyCommunity/rolify?branch=master) +# rolify [![Gem Version](https://badge.fury.io/rb/rolify.svg)](http://badge.fury.io/rb/rolify) [![build status](https://travis-ci.org/RolifyCommunity/rolify.svg)](http://travis-ci.org/RolifyCommunity/rolify) [![Code Climate](https://codeclimate.com/github/RolifyCommunity/rolify.svg)](https://codeclimate.com/github/RolifyCommunity/rolify) [![Coverage Status](https://coveralls.io/repos/RolifyCommunity/rolify/badge.svg?branch=master&service=github)](https://coveralls.io/github/RolifyCommunity/rolify?branch=master) Very simple Roles library without any authorization enforcement supporting scope on resource object. Let's see an example: @@ -13,13 +13,13 @@ <span style="color: red"><strong>*</strong></span>: authorization gem that doesn't provide a role class ## Requirements -* Rails >= 3.2 -* ActiveRecord >= 3.2 <b>or</b> Mongoid >= 3.1 -* supports ruby 2.0/1.9.3, JRuby 1.6.0+ (in 1.9 mode) and Rubinius 2.0.0dev (in 1.9 mode) +* Rails >= 4.2 +* ActiveRecord >= 4.2 <b>or</b> Mongoid >= 4.0 +* supports ruby 2.2+, JRuby 1.6.0+ (in 1.9 mode) and Rubinius 2.0.0dev (in 1.9 mode) * support of ruby 1.8 has been dropped due to Mongoid >=3.0 that only supports 1.9 new hash syntax ## Installation Add this to your Gemfile and run the `bundle` command. @@ -44,11 +44,11 @@ ``` rails g rolify:role Role User ``` -The generator will create your Role model, add a migration file, and update your User class with new class methods. +The generator will create your Role model, add a migration file, and update your User class with new class methods. ### 2. Run the migration (only required when using ActiveRecord) Let's migrate! @@ -177,9 +177,20 @@ user.add_role :moderator # sets a global role user.has_role? :moderator, Forum.first => true user.has_role? :moderator, Forum.last => true +``` + +To check if a user has the exact role scoped to a resource class: + +```ruby +user = User.find(5) +user.add_role :moderator # sets a global role +user.has_role? :moderator, Forum.first +=> true +user.has_strict_role? :moderator, Forum.last +=> false ``` ### 6. Resource roles querying Starting from rolify 3.0, you can search roles on instance level or class level resources.