mongoid_ability 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/mongoid_ability/ability.rb +12 -7
- data/lib/mongoid_ability/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbab2a3e7461bdec8e23c4d9b1027cac1575efed88174a704c4178b1e666c442
|
4
|
+
data.tar.gz: 03370daedb464860849fb9fab3144d6b718cad2a24044ea341deb7179d5879d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 451a7e6d02d26419a0629584bf7a1627e2b58c8688db01f5b9bdfdeebec693b77d09ad1a46c5b40272fb31245e4e80476fb81b87606d40940a0b6d62aa0802b7
|
7
|
+
data.tar.gz: '084a93016fbc7b4ec745502bbf98addb04754b7081738262e68682ac7ead9026b27c3b9439c81d86b895e3a1a9d603f58397ec5a61c6c23cdcb9240c890dab4e'
|
data/CHANGELOG.md
CHANGED
@@ -67,14 +67,19 @@ module MongoidAbility
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def model_adapter(model_class, action, options = {})
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
70
|
+
@model_adapter ||= {}
|
71
|
+
@model_adapter[model_class] ||= {}
|
72
|
+
@model_adapter[model_class][action] ||= {}
|
73
|
+
@model_adapter[model_class][action][options] ||= begin
|
74
|
+
adapter_class = CanCan::ModelAdapters::AbstractAdapter.adapter_class(model_class)
|
75
|
+
# include all rules that apply for descendants as well
|
76
|
+
# so the adapter can exclude include subclasses from critieria
|
77
|
+
rules = ([model_class] + model_class.descendants).inject([]) do |res, cls|
|
78
|
+
res += relevant_rules_for_query(action, cls)
|
79
|
+
res.uniq
|
80
|
+
end
|
81
|
+
adapter_class.new(model_class, rules, options)
|
76
82
|
end
|
77
|
-
adapter_class.new(model_class, rules, options)
|
78
83
|
end
|
79
84
|
|
80
85
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid_ability
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomas Celizna
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cancancan
|