README.md in bitroles-0.0.4 vs README.md in bitroles-0.1.0

- old
+ new

@@ -18,27 +18,35 @@ ## Usage ```ruby class MyModel < ActiveRecord::Base - - include Bitroles - - roles :admin, :moderator - + has_roles :admin, :moderator end ``` By default bitroles uses roles_mask integer column in your table to store the roles. You can change column name pretty easy: ```ruby class MyModel < ActiveRecord::Base + has_roles :admin, :moderator, mask_column: :someothercolumn +end +``` +## Available class methods +```ruby +MyModel.with_role(:admin) # Scope that finds all MyModel objects with admin role +``` - include Bitroles +## Available instance methods - roles :admin, :moderator, mask_column: :someothercolumn +```ruby +has_role? :admin # Checks if the object has admin role +is_admin? # Checks the above. It can be is_moderator? or is_whatever? depends on roles given to has_role +roles # Shows all roles of object (strings array) +obj.roles = [:admin, :moderator] # Sets admin and moderator role to obj +obj.admin = true # obj became admin (same for other roles) +obj.admin = false # obj is no longer an admin (same for other roles) -end ``` ## Contributing 1. Fork it