This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Mon Feb 16 12:25:40 -0800 2009 | |
| |
MIT-LICENSE | Mon Feb 16 11:09:08 -0800 2009 | |
| |
Manifest | Mon Feb 16 12:25:40 -0800 2009 | |
| |
README | Tue Feb 17 08:17:02 -0800 2009 | |
| |
Rakefile | Sat May 30 09:22:38 -0700 2009 | |
| |
generators/ | Mon Feb 16 12:43:21 -0800 2009 | |
| |
has_roles.gemspec | Fri Aug 28 06:26:26 -0700 2009 | |
| |
install.rb | Mon Feb 16 10:46:22 -0800 2009 | |
| |
lib/ | Fri Aug 28 06:26:26 -0700 2009 | |
| |
rails/ | Mon Feb 16 12:25:40 -0800 2009 | |
| |
tasks/ | Mon Feb 16 10:46:22 -0800 2009 | |
| |
test/ | Fri Aug 28 06:26:26 -0700 2009 | |
| |
uninstall.rb | Mon Feb 16 10:46:22 -0800 2009 |
README
Install
=======
$ gem source -a http://gems.github.com/
$ sudo gem install mintdigital-has_roles
# environment.rb
config.gem 'mintdigital-has_roles', :lib => 'has_roles'
Example
=======
In an ActiveRecord class:
has_roles :admin, :moderator
Then run:
./script/generate has_roles && rake db:migrate
Now your model has these instance methods:
add_role(:moderator) #=> true
remove_role(:admin) #=> true (doesn't have role)
has_role?(:admin) #=> false
can_have_role?(:writer) #=> false
# These are auto-generated based on your defined roles.
# They just call has_role?(name)
admin? #=> false
moderator? #=> true
---
Copyright (c) 2008 Krzysztof Zylawy, released under the MIT license







