Sha256: 9151d67bb54c0a4e13a32aac90e7859d71570801acfb3cdccf9e487b8d7016df

Contents?: true

Size: 729 Bytes

Versions: 2

Compression:

Stored size: 729 Bytes

Contents

Roles
=====

Simple roles system.

Migrations
=====

  create_table :roles do |t|
    t.string :name
  end
  Role.create(:name => "administrator")


  create_table :privileges, :id => false do |t|
    t.integer :user_id
    t.integer :role_id
  end


Examples
=======

Available methods if administrator role has been created: 
    user.administrator? 
    user.is?(:administrator)
    user.is_not?(:administrator)

Add more roles in the migration: moderator, uploader etc.
    user.moderator?
    user.is?(:uploader)

Find all users with moderator role
    User.find_with_role(:moderator)
or
    Role[:moderator].users


Copyright (c) 2008-2009 Mariusz Pietrzyk, 2009-2010 Mateusz Drożdżyński, released under the MIT license

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
objectreload-roles-0.1.4 README
objectreload-roles-0.1.2 README