role_authorization 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,8 +26,12 @@ RoleAuthorization::Rules.define :user do
26
26
  else
27
27
  if options[:resource]
28
28
  check_method = options[:check] || :id
29
- resource_instance = controller_instance.instance_eval(&options[:resource])
30
- controller_instance.current_user.id == resource_instance.try(check_method)
29
+ resource_instances = controller_instance.instance_eval(&options[:resource])
30
+ resource_instances = [resources_instances] unless resource_instances.is_a?(Array)
31
+
32
+ resource_instances.map do |resource_instance|
33
+ controller_instance.current_user.id == resource_instance.try(check_method)
34
+ end.include?(true)
31
35
  else
32
36
  false
33
37
  end
@@ -1,3 +1,3 @@
1
1
  module RoleAuthorization
2
- VERSION = "0.3.4"
2
+ VERSION = "0.3.5"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: role_authorization
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.4
5
+ version: 0.3.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - John 'asceth' Long