with_role 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +25 -10
- data/lib/with_role/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15414f099c71dd0aa5bebf0763225dd277d1d18268d01053eca84fd9f14fa7de
|
4
|
+
data.tar.gz: d1da261599ade41fadb82ec24b351f2a6dffd792a23fe2d57b2103c9b3cd6227
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae4454283d2c82a4828ae84519be4e31143ea592a40d4a2bd334b0ca0da60099bf0348bd1b3b2bab672de8bf45a742b4311e87a6cef161acf364656de50f2014
|
7
|
+
data.tar.gz: 244d47ab4a580fb5f208a20dddde719a516097e7d89e2200c1fb661ec29f6587a991a9d543d35581c0bfeb3ce08d52a01dd4690288c5f48a6bae802305bd19f1
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# WithRole
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Simple role feature
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -12,17 +10,34 @@ Add this line to your application's Gemfile:
|
|
12
10
|
gem 'with_role'
|
13
11
|
```
|
14
12
|
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
## Migration
|
14
|
+
```ruby
|
15
|
+
create_table :users do |t|
|
16
|
+
...
|
17
|
+
t.string :role
|
18
|
+
...
|
19
|
+
```
|
18
20
|
|
19
|
-
|
21
|
+
## Usage
|
20
22
|
|
21
|
-
|
23
|
+
```ruby
|
24
|
+
# models/user.rb
|
25
|
+
class User < ActiveRecord::Base
|
26
|
+
with_role
|
27
|
+
end
|
28
|
+
|
29
|
+
# config/initializers/with_role.rb
|
30
|
+
# whitelist allowed roles
|
31
|
+
::WithRole.configure do |config|
|
32
|
+
config[:available_roles] = %w(admin owner)
|
33
|
+
end
|
34
|
+
|
35
|
+
user.set_role(:admin)
|
36
|
+
user.admin_role?
|
37
|
+
=> true
|
38
|
+
```
|
22
39
|
|
23
|
-
## Usage
|
24
40
|
|
25
|
-
TODO: Write usage instructions here
|
26
41
|
|
27
42
|
## Development
|
28
43
|
|
data/lib/with_role/version.rb
CHANGED