README.rdoc in rolify-0.2.1 vs README.rdoc in rolify-0.3.0
- old
+ new
@@ -55,29 +55,40 @@
That's it !
=== 4. Check roles
-To check if a user has a global role
+To check if a user has a global role:
user = User.find(1)
+ user.has_role "admin" # sets a global role
user.has_role? "admin"
=> true
-To check if a user has a role scoped to a resource
+To check if a user has a role scoped to a resource:
user = User.find(2)
+ user.has_role "moderator", Forum.first # sets a role scoped to a resource
user.has_role? "moderator", Forum.first
=> true
user.has_role? "moderator", Forum.last
=> false
+A global role overrides resource role request:
+
+ user = User.find(3)
+ user.has_role "moderator" # sets a global role
+ user.has_role? "moderator", Forum.first
+ => true
+ user.has_role? "moderator", Forum.last
+ => true
+
== Questions or Problems?
-If you have any issues with rolify which you cannot find the solution to in the tiny README[https://github.com/EppO/rolify], please add an {issue on GitHub}[https://github.com/EppO/rolify/issues] or fork the project and send a pull request.
+If you have any issue or feature request with/for rolify, please add an {issue on GitHub}[https://github.com/EppO/rolify/issues] or fork the project and send a pull request.
== TODO
* put syntactic sugar:
- * +is_admin?+ like shortcuts
+ * <tt>is_admin?</tt> and <tt>is_admin_of?(resource)</tt> like shortcuts
* multiple role names query at the same time
* write a tutorial showing how to use rolify with CanCan and devise