installation:
- ruby script/generate roles Role User
installation will do:
Generates habtm table, creates role.rb with the habtm declaration. Adds declaration in user.rb (scans the code for "class User < ActiveRecord::Base", and puts the new code right after it.
Creates an admin user in users.yml, with a role named admin in roles.yml, including a fixture to demonstrate how to relate roles to users in roles_users.yml
Modify the user.rb (or corresponding user model) file, add the instance method has_role?
Generates RoleRequirementSystem against for the corresponding user model.
Generates a migration to make the necessary database changes
Scans ApplicationController, inserts the lines "include AuthenticatedSystem", and "include RoleRequirementSystem", if not already included.
Scans test_helper.rb and adds "includes RoleRequirementTestHelpers", if not already included.
Usage:
- add require_role "role_name" in controller, similar to before_filter