role_authorization 0.3.4 → 0.3.5

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.
@@ -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