effective_roles 2.0.0 → 2.0.1

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
  SHA256:
3
- metadata.gz: c2e79ad753b38bbae083f785fe11328f944bdd41c2470751c9ab0e34249f35cc
4
- data.tar.gz: 5846cd1d6ae353411d97e89b73e0fb97582a27a5a00a8272e2d3391a7a924287
3
+ metadata.gz: 06f6a3d9bee34bb09cb46dca52cf1d7837ed636c9a1888e244aff16c1f8b772c
4
+ data.tar.gz: 708a5daa2f874de24e5fe8b80f1cd1e4731d9fc30630f18ab16c666d47749e34
5
5
  SHA512:
6
- metadata.gz: 57c6dcaa1b1454f20f6ef6f813d9eb25fee44921cdec96b22c37e171ee8d8d52617d009fbc392847914079018c35f962b7579eb61fb99b89dbc51042f3c1fedb
7
- data.tar.gz: 5bb3f94bce4141aa78a04968e1652824386c2dd2d9c0d1ef4af9d7db5087afdb4e084afaec10d97ac371a8a5ffb63c85002f4d1e9c7133a98763fc1cc412d0c4
6
+ metadata.gz: a960a0fc29fbfec810675e507628dcf4c6aa2327685866c02e51d267a163869e3ed19c9f6cb92b3ceb7f21315c4d6c42f1f7e19efa374f944970778cf62ad3c7
7
+ data.tar.gz: 5d51969cfd0d88df911f5c79c550ce5085422ba82670250bb93781f5d95c298578d8c5b5c74bc3dfe4744f04b216ea2aaa00bccfefd097cf24491a5548d1f4a6
@@ -104,10 +104,11 @@ module EffectiveRoles
104
104
  assignable = if assignable_roles.kind_of?(Array)
105
105
  assignable_roles
106
106
  elsif current_user.present?
107
- current_roles = assignable_roles[resource.try(:class).to_s] || assignable_roles || {}
107
+ current_roles = assignable_roles[resource.class.to_s] || assignable_roles || {}
108
108
  current_user.roles.map { |role| current_roles[role] }.flatten.compact.uniq
109
109
  else
110
- assignable_roles[resource.try(:class).to_s] || []
110
+ current_roles = assignable_roles[resource.class.to_s] || assignable_roles || {}
111
+ current_roles.values.flatten.uniq
111
112
  end
112
113
 
113
114
  # Check boxes
@@ -1,3 +1,3 @@
1
1
  module EffectiveRoles
2
- VERSION = '2.0.0'.freeze
2
+ VERSION = '2.0.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_roles
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect