sevn 0.0.5 → 0.0.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 46b95be0b2c9ccf2e306de969982bc3e5cc66abd
4
- data.tar.gz: a348be59a8327b9d0b41ce31021fd6672208daaf
3
+ metadata.gz: 03d77ac9ed3fb8b4b194d897a47b5ee649c1f9a4
4
+ data.tar.gz: 4ecfacf816994d0b87be0fc6773b981e9619f022
5
5
  SHA512:
6
- metadata.gz: 17b0f6b99014037c0a9b975fe7a0e8dd3b24e226ffafccfb626d5755f1d7db7f126d2cb0bcabd335f53ade6ea1203397779a33c93700c13fefa8d9f1c115d710
7
- data.tar.gz: 7b56be6994f9ffc8512a7013f1ca93c6cca23ec24ccd1f38a622dc95e43c57d1794988d006267bf8784a9169846e77c80bc5c9ae883131de91834647ca213348
6
+ metadata.gz: 25d45e748be5b1d6a21ce467c42282a4b0d048524e5046272a32560ddfa5a4d5323f3f9869957c119505923827ffcb1d3c712f3bcd0b52100e0e0b915e0ef3e2
7
+ data.tar.gz: 31d5bab187102693868e8964b6ae759fd206354ea56a976ae54cac708b49300e00787748c4b6d67fa0e6dc718f6077d4fc5df3e3d48d1ca5656d30b79303b47f
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ v 0.0.6
2
+ - Instead of testing for Array, let's test for :each method
1
3
  v 0.0.5
2
4
  - Translate rails CollectionProxy to array
3
5
  v 0.0.4
@@ -105,11 +105,7 @@ module Sevn
105
105
  end
106
106
 
107
107
  def action_allowed?(object, action, subjects, options)
108
- if collection_proxy_defined? && subjects.class == ActiveRecord::Associations::CollectionProxy
109
- subjects = subjects.to_a
110
- end
111
-
112
- if subjects.kind_of?(Array)
108
+ if subjects.respond_to?(:each)
113
109
  # if subjects is an Array, let's group them by class
114
110
  # check if action is allowed for the whole class or to all the subjects of that class
115
111
  subjects.group_by(&:class).all? do |class_name, subjects_of_class|
@@ -168,10 +164,5 @@ module Sevn
168
164
  tr("-", "_").
169
165
  downcase
170
166
  end
171
-
172
- def collection_proxy_defined?
173
- defined?(ActiveRecord::Associations::CollectionProxy) == 'constant' &&
174
- ActiveRecord::Associations::CollectionProxy.class == Class
175
- end
176
167
  end
177
168
  end
@@ -1,3 +1,3 @@
1
1
  module Sevn
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sevn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Cervera