Project

role_play

0.0
No commit activity in last 3 years
No release in over 3 years
Rails 3-ified version of the beloved plugin
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0.8.7

Runtime

 Project Readme

Install

# from RubyGems:
$ gem install role_play

# or in your Gemfile
gem 'role_play'

Example

In an ActiveRecord class:

has_roles :admin, :moderator

Then run:

rails generate role_play_migration && 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

Tested in Ruby 1.9 and Rails 3.x on Travis CI: http://travis-ci.org/mintdigital/role_play

Build Status

Copyright (c) 2008 Mint Digital, released under the MIT license