devise_roles 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1c4a26a17a5bfe54bfe0db5a9cd2e0d373bd35e5
4
- data.tar.gz: 8dc3d925589c258720b3536db2a9af33ab79d2e3
3
+ metadata.gz: 596c2a0547dc9bf660cab64f0a01eb9442ce393a
4
+ data.tar.gz: 31741231bec77ce243a84a223fc7126733b13c59
5
5
  SHA512:
6
- metadata.gz: d23a4279e252c8c08a6add7c49c214fbea02ecf6b549d0b92632174ef2c2aae73436a923e20d5562232e21a6397b5e3b8ad786be09f3136474b3f04baacbb3ff
7
- data.tar.gz: 15b77bb2be4f712291fe73e8357ea74d20eb0ef12683bf314b07af8f3d0f336b6797fcbf8ee94969802f7ae132855a9831ad113a8e2599a054363a5edd73b9a0
6
+ metadata.gz: 64f541563a399566a29aab499e8059cda5b6be838b3069f4b87d5258b6c03f48cb31f10ec08ae18db66584d7902a1b1ac75cd3cd00c349b1f8ba93b0f4afad79
7
+ data.tar.gz: 5dacda552d758939723a0a1bac61dd51942e70adaaa971222df6e67527505a08fdb181a513b8b92b2dc1c9a89e7ab661b25e75a34ad28f6461367bf16e6da33f
data/README.md CHANGED
@@ -26,14 +26,14 @@ Also you need to include it in your Application
26
26
 
27
27
  In your **application.rb** add This
28
28
  ```ruby
29
- require 'encryption/encryption'
29
+ config.autoload_paths += %W(#{config.root}/lib)
30
30
  ```
31
31
  You can create and initializer and add next line to it, or just write at top of your controllers
32
32
  ```ruby
33
- config.autoload_paths += %W(#{config.root}/lib)
33
+ require 'encryption/encryption'
34
34
  ```
35
35
 
36
- ## Usage
36
+ ## Pre set up
37
37
 
38
38
  To use this gem features, you should create table **Roles** and add roles to it.
39
39
 
@@ -80,20 +80,22 @@ And this is all for setting up.
80
80
 
81
81
  Now you can go to learn methods for this *gem*.
82
82
 
83
- ## Devise Roles methods
83
+ ## DeviseRoles Usage
84
+
85
+ Here is a list of available methods.
84
86
 
85
87
  #### Enable only for Role
86
88
 
87
89
  If you want to enable some page for exact Role only, use this method
88
90
  ```ruby
89
- DeviseRoles.available_for_user_role(user_role_name, user_redirect_path)
91
+ DeviseRoles.available_for_user_role(user_role_name, current_user, user_redirect_path)
90
92
  ```
91
93
  Here is some example how to use it
92
94
  ```ruby
93
95
  def some_controller_method_name
94
96
  # Implement it at the top
95
97
  # In this example, current view would be available for admins only
96
- DeviseRoles.available_for_user_role('admin', root_path)
98
+ DeviseRoles.available_for_user_role('admin', current_user, root_path)
97
99
 
98
100
  # Some other code ...
99
101
  # That would be run if user is not **admin**
@@ -1,3 +1,3 @@
1
1
  module DeviseRoles
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
data/lib/devise_roles.rb CHANGED
@@ -3,7 +3,7 @@ require "devise_roles/version"
3
3
  module DeviseRoles
4
4
  def self.available_for_user_role(user_role_name, current_user, user_redirect_path)
5
5
  if current_user.role.name != user_role_name
6
- redirect_to admin_path, alert: "You should be #{user_role_name} to view that page!"
6
+ redirect_to user_redirect_path, alert: "You should be #{user_role_name} to view that page!"
7
7
  end
8
8
  end
9
9
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise_roles
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - MarkusBansky