mongoid_ability 0.3.5 → 0.3.6
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c3966d3f6bc2143789632f8075458b796341c98
|
4
|
+
data.tar.gz: 6b8f7778d4a847da6616be4441b11b90ba979bb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d9f643e20c1f6d8e0b255f5c2843f63db7836dd8a61d4961582f639b474f3ebb76d2ab595011319b631e1a65219b91e1307c73366f8544d0f66aaf0b016a550
|
7
|
+
data.tar.gz: 631e86ebe4293354623d1b6f0b8b6f5b146795f5f86330b506e1fe1f3a2455d9b3095f3aa67c0f8ecdd349098e7883db34323f76a7ed7a47bbc001fdc6793543
|
@@ -19,27 +19,27 @@ module MongoidAbility
|
|
19
19
|
|
20
20
|
def and_conditions
|
21
21
|
return unless conditions = [or_conditions, closed_ids_condition].compact.presence
|
22
|
-
{
|
22
|
+
{ '$and' => conditions }
|
23
23
|
end
|
24
24
|
|
25
25
|
def or_conditions
|
26
26
|
return unless conditions = [closed_types_condition, open_ids_condition].compact.presence
|
27
|
-
{
|
27
|
+
{ '$or' => conditions }
|
28
28
|
end
|
29
29
|
|
30
30
|
def closed_types_condition
|
31
31
|
return unless values.closed_types.present?
|
32
|
-
{ :
|
32
|
+
{ _type: { '$nin' => values.closed_types } }
|
33
33
|
end
|
34
34
|
|
35
35
|
def open_ids_condition
|
36
36
|
return unless values.open_types_and_ids.present?
|
37
|
-
{ :
|
37
|
+
{ _id: { '$in' => values.open_types_and_ids.map(&:id) } }
|
38
38
|
end
|
39
39
|
|
40
40
|
def closed_ids_condition
|
41
41
|
return unless values.closed_ids.present?
|
42
|
-
{ :
|
42
|
+
{ _id: { '$nin' => values.closed_ids } }
|
43
43
|
end
|
44
44
|
|
45
45
|
# ---------------------------------------------------------------------
|