mongoid-collection-separated 0.1.2 → 0.1.3
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b0dfbf177db8b81faeb6a4d9f2ae080eb373d147636b003667ef5e8e58e2e86
|
4
|
+
data.tar.gz: c95fa5dc1af5a6c6999e93bebc3e5438ee477433dd61c0861b7b27bca53c69d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0902c52179e2f075acb69c7a2f87200ea765024050d9ecd8326d49da82a5497fcf64ffbffe552c04cb833b88ca7bf66b351ce07d438d0f8baceb4b933912399f'
|
7
|
+
data.tar.gz: c172cf884b0ac8199a4c9a6ff2d8a7406b92d4c0f584d332e408516b65336ae4d26913f322be0dfcd2306c41a1356f72b77c4287e11b1430f4f50c03ba82eac7
|
@@ -6,8 +6,8 @@ module Mongoid
|
|
6
6
|
# 1. Get form_id from selector
|
7
7
|
# 2. If collection is entries, not matter from context or current collection object, and form has entries_separated flag set, set collection name instance variable to entries plus form_id as new collection name
|
8
8
|
|
9
|
-
def
|
10
|
-
context =
|
9
|
+
def create_context_with_separated
|
10
|
+
context = create_context_without_separated
|
11
11
|
query_class = instance_variable_get :@klass
|
12
12
|
new_collection_name = calc_new_collection_name query_class
|
13
13
|
unless new_collection_name.blank?
|
@@ -38,8 +38,8 @@ module Mongoid
|
|
38
38
|
selector[query_class.separated_field.to_s]
|
39
39
|
end
|
40
40
|
|
41
|
-
alias_method :
|
42
|
-
alias_method :create_context, :
|
41
|
+
alias_method :create_context_without_separated, :create_context
|
42
|
+
alias_method :create_context, :create_context_with_separated
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
@@ -53,8 +53,8 @@ module Mongoid
|
|
53
53
|
# 1. 'base' should be an instance of Form
|
54
54
|
# 2. If form has entries_separated flat and collection name is entries, clone a new context because it is build each time when called and set to context. Then remove form_id from selector because all the entries inside the new collection has the same form_id
|
55
55
|
|
56
|
-
def
|
57
|
-
cri =
|
56
|
+
def criteria_with_separated
|
57
|
+
cri = criteria_without_separated
|
58
58
|
query_class = cri.instance_variable_get :@klass
|
59
59
|
if should_query_from_separated_collection? query_class
|
60
60
|
context = cri.context.clone
|
@@ -83,8 +83,8 @@ module Mongoid
|
|
83
83
|
query_class.send(query_class.calc_collection_name_fun, base.send(query_class.separated_parent_field))
|
84
84
|
end
|
85
85
|
|
86
|
-
alias_method :
|
87
|
-
alias_method :criteria, :
|
86
|
+
alias_method :criteria_without_separated, :criteria
|
87
|
+
alias_method :criteria, :criteria_with_separated
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-collection-separated
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- aibotyu
|
@@ -120,8 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
- !ruby/object:Gem::Version
|
121
121
|
version: '0'
|
122
122
|
requirements: []
|
123
|
-
|
124
|
-
rubygems_version: 2.7.8
|
123
|
+
rubygems_version: 3.0.1
|
125
124
|
signing_key:
|
126
125
|
specification_version: 4
|
127
126
|
summary: Save the mongoid model into different collections by condition
|