the_role 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +20 -5
- data/lib/tasks/roles.rake +3 -3
- data/lib/the_role/version.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -13,7 +13,6 @@ Gemfile
|
|
13
13
|
|
14
14
|
``` ruby
|
15
15
|
gem 'the_role'
|
16
|
-
gem 'haml'
|
17
16
|
```
|
18
17
|
|
19
18
|
``` ruby
|
@@ -24,15 +23,33 @@ Gemfile
|
|
24
23
|
rake the_role_engine:install:migrations
|
25
24
|
>> Copied migration 20111028145956_create_roles.rb from the_role_engine
|
26
25
|
|
27
|
-
|
26
|
+
rails g model user role_id:integer
|
27
|
+
rails g model role --migration=false
|
28
|
+
|
29
|
+
rake db:create && rake db:migrate
|
28
30
|
```
|
29
31
|
|
32
|
+
Creating roles for test
|
33
|
+
|
30
34
|
``` ruby
|
31
|
-
rake db:roles:
|
35
|
+
rake db:roles:test
|
32
36
|
>> Administrator, Moderator of pages, User, Demo
|
33
37
|
```
|
34
38
|
|
39
|
+
## Manage roles
|
40
|
+
|
35
41
|
``` ruby
|
42
|
+
rails s
|
43
|
+
```
|
44
|
+
|
45
|
+
**admin_roles_path** => **http://localhost:3000/admin/roles**
|
46
|
+
|
47
|
+
## How it works
|
48
|
+
|
49
|
+
|
50
|
+
``` ruby
|
51
|
+
rails c
|
52
|
+
|
36
53
|
user = User.first
|
37
54
|
user.role = Role.where(:name => :demo).first
|
38
55
|
user.save
|
@@ -69,6 +86,4 @@ user.has_role? :any_crazy_name, :any_crazy_name
|
|
69
86
|
|
70
87
|
```
|
71
88
|
|
72
|
-
Manage your roles you can with **admin_roles_path** => **http://localhost:3000/admin/roles**
|
73
|
-
|
74
89
|
Copyright (c) 2011 [Ilya N. Zykin Github.com/the-teacher], released under the MIT license
|
data/lib/tasks/roles.rake
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
namespace :db do
|
2
2
|
namespace :roles do
|
3
|
-
# rake db:roles:
|
3
|
+
# rake db:roles:test
|
4
4
|
desc 'create roles'
|
5
|
-
task :
|
5
|
+
task :test => :environment do
|
6
6
|
# ADMIN
|
7
7
|
role = {
|
8
8
|
:system => {
|
@@ -115,6 +115,6 @@ namespace :db do
|
|
115
115
|
puts 'Demo'
|
116
116
|
|
117
117
|
puts 'Roles created'
|
118
|
-
end#
|
118
|
+
end#test
|
119
119
|
end#roles
|
120
120
|
end#db
|
data/lib/the_role/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: the_role
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-10-31 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: haml
|
16
|
-
requirement: &
|
16
|
+
requirement: &77267270 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '3.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *77267270
|
25
25
|
description: TheRole - simple, but powerful role system for ROR applications
|
26
26
|
email:
|
27
27
|
- zykin-ilya@ya.ru
|