devise_roles 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/devise_roles/version.rb +1 -1
- data/lib/devise_roles.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a309914879b26ba2c286b2a9ae118deb3db8ef38
|
4
|
+
data.tar.gz: af68bdfae1016d0b727bb7dd203a206ca07b5ec9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c21103b89bb4585e015a215f2f7f48a5dad502c086ccd1c26b7fc436e7d1cfd3f8dccc92e12c25890fb2473d2c465879fe4e9e9acc907fe00a069346255c4dd
|
7
|
+
data.tar.gz: 8202f10944ece07db11430c6f0d0e59d066b69e7eefee56432234cc8ebb6c6d7b3983be68ecf48d2e06111f87608ef0da1d3cb5db8865ee11d63dfef8c1284d9
|
data/README.md
CHANGED
@@ -75,14 +75,14 @@ Now you can go to learn methods for this *gem*.
|
|
75
75
|
|
76
76
|
If you want to enable some page for exact Role only, use this method
|
77
77
|
```ruby
|
78
|
-
available_for_user_role(user_role_name, user_redirect_path)
|
78
|
+
DeviseRoles.available_for_user_role(user_role_name, user_redirect_path)
|
79
79
|
```
|
80
80
|
Here is some example how to use it
|
81
81
|
```ruby
|
82
82
|
def some_controller_method_name
|
83
83
|
# Implement it at the top
|
84
84
|
# In this example, current view would be available for admins only
|
85
|
-
available_for_user_role('admin', root_path)
|
85
|
+
DeviseRoles.available_for_user_role('admin', root_path)
|
86
86
|
|
87
87
|
# Some other code ...
|
88
88
|
# That would be run if user is not **admin**
|
data/lib/devise_roles/version.rb
CHANGED
data/lib/devise_roles.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "devise_roles/version"
|
2
2
|
|
3
|
-
|
3
|
+
module DeviseRoles
|
4
4
|
def available_for_user_role(user_role_name, user_redirect_path)
|
5
5
|
if current_user.role.name != user_role_name
|
6
6
|
redirect_to admin_path, alert: "You should be #{user_role_name} to view that page!"
|