Sha256: 615ef21514266fa05240f2c7ccde25563f27f3fa3d78a33d3fffd44a7b68b046
Contents?: true
Size: 1.44 KB
Versions: 1
Compression:
Stored size: 1.44 KB
Contents
## TheRole Gem for providing simple, but powerful and flexible role system for ROR3 applications. Based on Hashes. * Based on MVC semantik (easy to understand what's happening) * Realtime dynamically management with simple interface * Customizable ## Installation Gemfile ``` ruby gem 'the_role' ``` ``` ruby bundle install ``` ``` ruby rake the_role_engine:install:migrations >> Copied migration 20111028145956_create_roles.rb from the_role_engine rails g model user role_id:integer rails g model role --migration=false rake db:create && rake db:migrate ``` Creating roles for test ``` ruby rake db:roles:test >> Administrator, Moderator of pages, User, Demo ``` ## Manage roles ``` ruby rails s ``` **admin_roles_path** => **http://localhost:3000/admin/roles** ## How it works ``` ruby rails c user = User.first user.role = Role.where(:name => :demo).first user.save user.admin? => false user.moderator? :pages => false user.has_role? :pages, :index => true user.role = Role.where(:name => :moderator).first user.save user.admin? => false user.moderator? :pages => true user.has_role? :pages, :any_crazy_name => true user.role = Role.where(:name => :admin).first user.save user.admin? => true user.moderator? :pages => true user.moderator? :any_crazy_name => true user.has_role? :any_crazy_name, :any_crazy_name => true ``` Copyright (c) 2011 [Ilya N. Zykin Github.com/the-teacher], released under the MIT license
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
the_role-1.1.1 | README.md |