mongoid-pre 2.0.0.beta1 → 2.0.0.pre
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.
- data/.watchr +15 -10
- data/HISTORY +342 -0
- data/README.rdoc +8 -1
- data/Rakefile +2 -3
- data/VERSION +1 -1
- data/lib/mongoid/associations/{embedded_in.rb → belongs_to.rb} +4 -4
- data/lib/mongoid/associations/belongs_to_related.rb +9 -6
- data/lib/mongoid/associations/{embeds_many.rb → has_many.rb} +20 -33
- data/lib/mongoid/associations/has_many_related.rb +4 -28
- data/lib/mongoid/associations/{embeds_one.rb → has_one.rb} +6 -6
- data/lib/mongoid/associations/options.rb +6 -1
- data/lib/mongoid/associations.rb +32 -41
- data/lib/mongoid/attributes.rb +6 -13
- data/lib/mongoid/collection.rb +1 -2
- data/lib/mongoid/commands/delete.rb +1 -1
- data/lib/mongoid/commands/delete_all.rb +1 -4
- data/lib/mongoid/commands/destroy.rb +1 -1
- data/lib/mongoid/commands/destroy_all.rb +1 -3
- data/lib/mongoid/commands/save.rb +0 -1
- data/lib/mongoid/commands.rb +13 -2
- data/lib/mongoid/components.rb +1 -6
- data/lib/mongoid/config.rb +1 -5
- data/lib/mongoid/contexts/enumerable.rb +17 -54
- data/lib/mongoid/contexts/mongo.rb +38 -101
- data/lib/mongoid/contexts/paging.rb +2 -2
- data/lib/mongoid/contexts.rb +0 -21
- data/lib/mongoid/criteria.rb +73 -15
- data/lib/mongoid/criterion/inclusion.rb +0 -2
- data/lib/mongoid/criterion/optional.rb +2 -10
- data/lib/mongoid/document.rb +30 -41
- data/lib/mongoid/extensions.rb +0 -15
- data/lib/mongoid/field.rb +7 -20
- data/lib/mongoid/fields.rb +10 -15
- data/lib/mongoid/finders.rb +98 -10
- data/lib/mongoid/identity.rb +2 -8
- data/lib/mongoid/named_scope.rb +0 -2
- data/lib/mongoid/validations/associated.rb +8 -3
- data/lib/mongoid/validations/uniqueness.rb +7 -2
- data/lib/mongoid/validations.rb +2 -2
- data/lib/mongoid/versioning.rb +1 -1
- data/lib/mongoid.rb +5 -21
- data/mongoid.gemspec +19 -59
- data/spec/integration/mongoid/associations_spec.rb +3 -42
- data/spec/integration/mongoid/attributes_spec.rb +2 -2
- data/spec/integration/mongoid/commands_spec.rb +13 -27
- data/spec/integration/mongoid/contexts/enumerable_spec.rb +0 -13
- data/spec/integration/mongoid/criteria_spec.rb +3 -50
- data/spec/integration/mongoid/document_spec.rb +5 -72
- data/spec/integration/mongoid/finders_spec.rb +28 -85
- data/spec/models/address.rb +3 -3
- data/spec/models/animal.rb +2 -2
- data/spec/models/country_code.rb +2 -2
- data/spec/models/game.rb +1 -2
- data/spec/models/inheritance.rb +5 -5
- data/spec/models/location.rb +2 -2
- data/spec/models/name.rb +3 -3
- data/spec/models/namespacing.rb +2 -2
- data/spec/models/patient.rb +0 -2
- data/spec/models/person.rb +4 -6
- data/spec/models/pet.rb +3 -3
- data/spec/models/pet_owner.rb +3 -3
- data/spec/models/phone.rb +3 -3
- data/spec/models/post.rb +1 -1
- data/spec/models/translation.rb +2 -2
- data/spec/models/vet_visit.rb +2 -2
- data/spec/spec_helper.rb +2 -2
- data/spec/unit/mongoid/associations/belongs_to_related_spec.rb +0 -4
- data/spec/unit/mongoid/associations/{embedded_in_spec.rb → belongs_to_spec.rb} +11 -11
- data/spec/unit/mongoid/associations/has_many_related_spec.rb +14 -45
- data/spec/unit/mongoid/associations/{embeds_many_spec.rb → has_many_spec.rb} +34 -79
- data/spec/unit/mongoid/associations/{embeds_one_spec.rb → has_one_spec.rb} +18 -18
- data/spec/unit/mongoid/associations/options_spec.rb +19 -20
- data/spec/unit/mongoid/associations_spec.rb +12 -74
- data/spec/unit/mongoid/attributes_spec.rb +51 -83
- data/spec/unit/mongoid/collection_spec.rb +0 -46
- data/spec/unit/mongoid/commands/delete_all_spec.rb +8 -9
- data/spec/unit/mongoid/commands/delete_spec.rb +3 -6
- data/spec/unit/mongoid/commands/destroy_all_spec.rb +2 -0
- data/spec/unit/mongoid/commands/destroy_spec.rb +3 -10
- data/spec/unit/mongoid/commands_spec.rb +11 -20
- data/spec/unit/mongoid/config_spec.rb +0 -18
- data/spec/unit/mongoid/contexts/enumerable_spec.rb +11 -198
- data/spec/unit/mongoid/contexts/mongo_spec.rb +54 -357
- data/spec/unit/mongoid/criteria_spec.rb +78 -107
- data/spec/unit/mongoid/criterion/exclusion_spec.rb +13 -3
- data/spec/unit/mongoid/criterion/inclusion_spec.rb +19 -25
- data/spec/unit/mongoid/criterion/optional_spec.rb +18 -25
- data/spec/unit/mongoid/document_spec.rb +34 -71
- data/spec/unit/mongoid/extensions/array/conversions_spec.rb +2 -2
- data/spec/unit/mongoid/extensions/datetime/conversions_spec.rb +3 -0
- data/spec/unit/mongoid/extensions/object/conversions_spec.rb +2 -16
- data/spec/unit/mongoid/extensions/proc/scoping_spec.rb +1 -1
- data/spec/unit/mongoid/field_spec.rb +0 -62
- data/spec/unit/mongoid/fields_spec.rb +0 -33
- data/spec/unit/mongoid/finders_spec.rb +1 -37
- data/spec/unit/mongoid/identity_spec.rb +6 -47
- data/spec/unit/mongoid/named_scope_spec.rb +2 -15
- data/spec/unit/mongoid/scope_spec.rb +1 -1
- data/spec/unit/mongoid/validations/uniqueness_spec.rb +3 -3
- data/spec/unit/mongoid_spec.rb +2 -11
- metadata +14 -64
- data/lib/mongoid/associations/meta_data.rb +0 -28
- data/lib/mongoid/contexts/ids.rb +0 -25
- data/lib/mongoid/deprecation.rb +0 -22
- data/lib/mongoid/dirty.rb +0 -203
- data/lib/mongoid/extensions/big_decimal/conversions.rb +0 -19
- data/lib/mongoid/extensions/binary/conversions.rb +0 -17
- data/lib/mongoid/extensions/objectid/conversions.rb +0 -15
- data/lib/mongoid/extras.rb +0 -61
- data/lib/mongoid/javascript/functions.yml +0 -37
- data/lib/mongoid/javascript.rb +0 -21
- data/lib/mongoid/observable.rb +0 -30
- data/lib/mongoid/paths.rb +0 -54
- data/lib/mongoid/persistence/command.rb +0 -20
- data/lib/mongoid/persistence/insert.rb +0 -71
- data/lib/mongoid/persistence/update.rb +0 -78
- data/lib/mongoid/persistence.rb +0 -27
- data/lib/mongoid/state.rb +0 -32
- data/spec/integration/mongoid/dirty_spec.rb +0 -70
- data/spec/integration/mongoid/persistence/update_spec.rb +0 -46
- data/spec/models/callbacks.rb +0 -18
- data/spec/unit/mongoid/associations/meta_data_spec.rb +0 -88
- data/spec/unit/mongoid/contexts_spec.rb +0 -25
- data/spec/unit/mongoid/deprecation_spec.rb +0 -24
- data/spec/unit/mongoid/dirty_spec.rb +0 -286
- data/spec/unit/mongoid/extensions/big_decimal/conversions_spec.rb +0 -22
- data/spec/unit/mongoid/extensions/binary/conversions_spec.rb +0 -22
- data/spec/unit/mongoid/extras_spec.rb +0 -102
- data/spec/unit/mongoid/javascript_spec.rb +0 -48
- data/spec/unit/mongoid/observable_spec.rb +0 -46
- data/spec/unit/mongoid/paths_spec.rb +0 -124
- data/spec/unit/mongoid/persistence/insert_spec.rb +0 -175
- data/spec/unit/mongoid/persistence/update_spec.rb +0 -148
- data/spec/unit/mongoid/persistence_spec.rb +0 -40
- data/spec/unit/mongoid/state_spec.rb +0 -83
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mongoid-pre
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.0.
|
|
4
|
+
version: 2.0.0.pre
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Durran Jordan
|
|
@@ -10,7 +10,7 @@ autorequire:
|
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
12
|
|
|
13
|
-
date: 2010-
|
|
13
|
+
date: 2010-02-13 00:00:00 +01:00
|
|
14
14
|
default_executable:
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
@@ -41,7 +41,7 @@ dependencies:
|
|
|
41
41
|
requirements:
|
|
42
42
|
- - ">="
|
|
43
43
|
- !ruby/object:Gem::Version
|
|
44
|
-
version: 0.
|
|
44
|
+
version: 0.18.2
|
|
45
45
|
version:
|
|
46
46
|
- !ruby/object:Gem::Dependency
|
|
47
47
|
name: rspec
|
|
@@ -51,7 +51,7 @@ dependencies:
|
|
|
51
51
|
requirements:
|
|
52
52
|
- - ">="
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: 1.
|
|
54
|
+
version: 1.2.9
|
|
55
55
|
version:
|
|
56
56
|
- !ruby/object:Gem::Dependency
|
|
57
57
|
name: mocha
|
|
@@ -74,6 +74,7 @@ extra_rdoc_files:
|
|
|
74
74
|
files:
|
|
75
75
|
- .gitignore
|
|
76
76
|
- .watchr
|
|
77
|
+
- HISTORY
|
|
77
78
|
- MIT_LICENSE
|
|
78
79
|
- README.rdoc
|
|
79
80
|
- Rakefile
|
|
@@ -81,13 +82,12 @@ files:
|
|
|
81
82
|
- caliper.yml
|
|
82
83
|
- lib/mongoid.rb
|
|
83
84
|
- lib/mongoid/associations.rb
|
|
85
|
+
- lib/mongoid/associations/belongs_to.rb
|
|
84
86
|
- lib/mongoid/associations/belongs_to_related.rb
|
|
85
|
-
- lib/mongoid/associations/
|
|
86
|
-
- lib/mongoid/associations/embeds_many.rb
|
|
87
|
-
- lib/mongoid/associations/embeds_one.rb
|
|
87
|
+
- lib/mongoid/associations/has_many.rb
|
|
88
88
|
- lib/mongoid/associations/has_many_related.rb
|
|
89
|
+
- lib/mongoid/associations/has_one.rb
|
|
89
90
|
- lib/mongoid/associations/has_one_related.rb
|
|
90
|
-
- lib/mongoid/associations/meta_data.rb
|
|
91
91
|
- lib/mongoid/associations/options.rb
|
|
92
92
|
- lib/mongoid/associations/proxy.rb
|
|
93
93
|
- lib/mongoid/attributes.rb
|
|
@@ -110,7 +110,6 @@ files:
|
|
|
110
110
|
- lib/mongoid/config.rb
|
|
111
111
|
- lib/mongoid/contexts.rb
|
|
112
112
|
- lib/mongoid/contexts/enumerable.rb
|
|
113
|
-
- lib/mongoid/contexts/ids.rb
|
|
114
113
|
- lib/mongoid/contexts/mongo.rb
|
|
115
114
|
- lib/mongoid/contexts/paging.rb
|
|
116
115
|
- lib/mongoid/criteria.rb
|
|
@@ -119,8 +118,6 @@ files:
|
|
|
119
118
|
- lib/mongoid/criterion/inclusion.rb
|
|
120
119
|
- lib/mongoid/criterion/optional.rb
|
|
121
120
|
- lib/mongoid/cursor.rb
|
|
122
|
-
- lib/mongoid/deprecation.rb
|
|
123
|
-
- lib/mongoid/dirty.rb
|
|
124
121
|
- lib/mongoid/document.rb
|
|
125
122
|
- lib/mongoid/errors.rb
|
|
126
123
|
- lib/mongoid/extensions.rb
|
|
@@ -129,8 +126,6 @@ files:
|
|
|
129
126
|
- lib/mongoid/extensions/array/assimilation.rb
|
|
130
127
|
- lib/mongoid/extensions/array/conversions.rb
|
|
131
128
|
- lib/mongoid/extensions/array/parentization.rb
|
|
132
|
-
- lib/mongoid/extensions/big_decimal/conversions.rb
|
|
133
|
-
- lib/mongoid/extensions/binary/conversions.rb
|
|
134
129
|
- lib/mongoid/extensions/boolean/conversions.rb
|
|
135
130
|
- lib/mongoid/extensions/date/conversions.rb
|
|
136
131
|
- lib/mongoid/extensions/datetime/conversions.rb
|
|
@@ -143,21 +138,17 @@ files:
|
|
|
143
138
|
- lib/mongoid/extensions/integer/conversions.rb
|
|
144
139
|
- lib/mongoid/extensions/nil/assimilation.rb
|
|
145
140
|
- lib/mongoid/extensions/object/conversions.rb
|
|
146
|
-
- lib/mongoid/extensions/objectid/conversions.rb
|
|
147
141
|
- lib/mongoid/extensions/proc/scoping.rb
|
|
148
142
|
- lib/mongoid/extensions/string/conversions.rb
|
|
149
143
|
- lib/mongoid/extensions/string/inflections.rb
|
|
150
144
|
- lib/mongoid/extensions/symbol/inflections.rb
|
|
151
145
|
- lib/mongoid/extensions/time/conversions.rb
|
|
152
|
-
- lib/mongoid/extras.rb
|
|
153
146
|
- lib/mongoid/factory.rb
|
|
154
147
|
- lib/mongoid/field.rb
|
|
155
148
|
- lib/mongoid/fields.rb
|
|
156
149
|
- lib/mongoid/finders.rb
|
|
157
150
|
- lib/mongoid/identity.rb
|
|
158
151
|
- lib/mongoid/indexes.rb
|
|
159
|
-
- lib/mongoid/javascript.rb
|
|
160
|
-
- lib/mongoid/javascript/functions.yml
|
|
161
152
|
- lib/mongoid/matchers.rb
|
|
162
153
|
- lib/mongoid/matchers/all.rb
|
|
163
154
|
- lib/mongoid/matchers/default.rb
|
|
@@ -172,14 +163,7 @@ files:
|
|
|
172
163
|
- lib/mongoid/matchers/size.rb
|
|
173
164
|
- lib/mongoid/memoization.rb
|
|
174
165
|
- lib/mongoid/named_scope.rb
|
|
175
|
-
- lib/mongoid/observable.rb
|
|
176
|
-
- lib/mongoid/paths.rb
|
|
177
|
-
- lib/mongoid/persistence.rb
|
|
178
|
-
- lib/mongoid/persistence/command.rb
|
|
179
|
-
- lib/mongoid/persistence/insert.rb
|
|
180
|
-
- lib/mongoid/persistence/update.rb
|
|
181
166
|
- lib/mongoid/scope.rb
|
|
182
|
-
- lib/mongoid/state.rb
|
|
183
167
|
- lib/mongoid/timestamps.rb
|
|
184
168
|
- lib/mongoid/validations.rb
|
|
185
169
|
- lib/mongoid/validations/associated.rb
|
|
@@ -193,16 +177,13 @@ files:
|
|
|
193
177
|
- spec/integration/mongoid/commands_spec.rb
|
|
194
178
|
- spec/integration/mongoid/contexts/enumerable_spec.rb
|
|
195
179
|
- spec/integration/mongoid/criteria_spec.rb
|
|
196
|
-
- spec/integration/mongoid/dirty_spec.rb
|
|
197
180
|
- spec/integration/mongoid/document_spec.rb
|
|
198
181
|
- spec/integration/mongoid/extensions_spec.rb
|
|
199
182
|
- spec/integration/mongoid/finders_spec.rb
|
|
200
183
|
- spec/integration/mongoid/inheritance_spec.rb
|
|
201
184
|
- spec/integration/mongoid/named_scope_spec.rb
|
|
202
|
-
- spec/integration/mongoid/persistence/update_spec.rb
|
|
203
185
|
- spec/models/address.rb
|
|
204
186
|
- spec/models/animal.rb
|
|
205
|
-
- spec/models/callbacks.rb
|
|
206
187
|
- spec/models/comment.rb
|
|
207
188
|
- spec/models/country_code.rb
|
|
208
189
|
- spec/models/employer.rb
|
|
@@ -223,12 +204,11 @@ files:
|
|
|
223
204
|
- spec/spec.opts
|
|
224
205
|
- spec/spec_helper.rb
|
|
225
206
|
- spec/unit/mongoid/associations/belongs_to_related_spec.rb
|
|
226
|
-
- spec/unit/mongoid/associations/
|
|
227
|
-
- spec/unit/mongoid/associations/embeds_many_spec.rb
|
|
228
|
-
- spec/unit/mongoid/associations/embeds_one_spec.rb
|
|
207
|
+
- spec/unit/mongoid/associations/belongs_to_spec.rb
|
|
229
208
|
- spec/unit/mongoid/associations/has_many_related_spec.rb
|
|
209
|
+
- spec/unit/mongoid/associations/has_many_spec.rb
|
|
230
210
|
- spec/unit/mongoid/associations/has_one_related_spec.rb
|
|
231
|
-
- spec/unit/mongoid/associations/
|
|
211
|
+
- spec/unit/mongoid/associations/has_one_spec.rb
|
|
232
212
|
- spec/unit/mongoid/associations/options_spec.rb
|
|
233
213
|
- spec/unit/mongoid/associations_spec.rb
|
|
234
214
|
- spec/unit/mongoid/attributes_spec.rb
|
|
@@ -248,23 +228,18 @@ files:
|
|
|
248
228
|
- spec/unit/mongoid/config_spec.rb
|
|
249
229
|
- spec/unit/mongoid/contexts/enumerable_spec.rb
|
|
250
230
|
- spec/unit/mongoid/contexts/mongo_spec.rb
|
|
251
|
-
- spec/unit/mongoid/contexts_spec.rb
|
|
252
231
|
- spec/unit/mongoid/criteria_spec.rb
|
|
253
232
|
- spec/unit/mongoid/criterion/complex_spec.rb
|
|
254
233
|
- spec/unit/mongoid/criterion/exclusion_spec.rb
|
|
255
234
|
- spec/unit/mongoid/criterion/inclusion_spec.rb
|
|
256
235
|
- spec/unit/mongoid/criterion/optional_spec.rb
|
|
257
236
|
- spec/unit/mongoid/cursor_spec.rb
|
|
258
|
-
- spec/unit/mongoid/deprecation_spec.rb
|
|
259
|
-
- spec/unit/mongoid/dirty_spec.rb
|
|
260
237
|
- spec/unit/mongoid/document_spec.rb
|
|
261
238
|
- spec/unit/mongoid/errors_spec.rb
|
|
262
239
|
- spec/unit/mongoid/extensions/array/accessors_spec.rb
|
|
263
240
|
- spec/unit/mongoid/extensions/array/assimilation_spec.rb
|
|
264
241
|
- spec/unit/mongoid/extensions/array/conversions_spec.rb
|
|
265
242
|
- spec/unit/mongoid/extensions/array/parentization_spec.rb
|
|
266
|
-
- spec/unit/mongoid/extensions/big_decimal/conversions_spec.rb
|
|
267
|
-
- spec/unit/mongoid/extensions/binary/conversions_spec.rb
|
|
268
243
|
- spec/unit/mongoid/extensions/boolean/conversions_spec.rb
|
|
269
244
|
- spec/unit/mongoid/extensions/date/conversions_spec.rb
|
|
270
245
|
- spec/unit/mongoid/extensions/datetime/conversions_spec.rb
|
|
@@ -282,14 +257,12 @@ files:
|
|
|
282
257
|
- spec/unit/mongoid/extensions/string/inflections_spec.rb
|
|
283
258
|
- spec/unit/mongoid/extensions/symbol/inflections_spec.rb
|
|
284
259
|
- spec/unit/mongoid/extensions/time/conversions_spec.rb
|
|
285
|
-
- spec/unit/mongoid/extras_spec.rb
|
|
286
260
|
- spec/unit/mongoid/factory_spec.rb
|
|
287
261
|
- spec/unit/mongoid/field_spec.rb
|
|
288
262
|
- spec/unit/mongoid/fields_spec.rb
|
|
289
263
|
- spec/unit/mongoid/finders_spec.rb
|
|
290
264
|
- spec/unit/mongoid/identity_spec.rb
|
|
291
265
|
- spec/unit/mongoid/indexes_spec.rb
|
|
292
|
-
- spec/unit/mongoid/javascript_spec.rb
|
|
293
266
|
- spec/unit/mongoid/matchers/all_spec.rb
|
|
294
267
|
- spec/unit/mongoid/matchers/default_spec.rb
|
|
295
268
|
- spec/unit/mongoid/matchers/exists_spec.rb
|
|
@@ -304,13 +277,7 @@ files:
|
|
|
304
277
|
- spec/unit/mongoid/matchers_spec.rb
|
|
305
278
|
- spec/unit/mongoid/memoization_spec.rb
|
|
306
279
|
- spec/unit/mongoid/named_scope_spec.rb
|
|
307
|
-
- spec/unit/mongoid/observable_spec.rb
|
|
308
|
-
- spec/unit/mongoid/paths_spec.rb
|
|
309
|
-
- spec/unit/mongoid/persistence/insert_spec.rb
|
|
310
|
-
- spec/unit/mongoid/persistence/update_spec.rb
|
|
311
|
-
- spec/unit/mongoid/persistence_spec.rb
|
|
312
280
|
- spec/unit/mongoid/scope_spec.rb
|
|
313
|
-
- spec/unit/mongoid/state_spec.rb
|
|
314
281
|
- spec/unit/mongoid/timestamps_spec.rb
|
|
315
282
|
- spec/unit/mongoid/validations/associated_spec.rb
|
|
316
283
|
- spec/unit/mongoid/validations/uniqueness_spec.rb
|
|
@@ -351,16 +318,13 @@ test_files:
|
|
|
351
318
|
- spec/integration/mongoid/commands_spec.rb
|
|
352
319
|
- spec/integration/mongoid/contexts/enumerable_spec.rb
|
|
353
320
|
- spec/integration/mongoid/criteria_spec.rb
|
|
354
|
-
- spec/integration/mongoid/dirty_spec.rb
|
|
355
321
|
- spec/integration/mongoid/document_spec.rb
|
|
356
322
|
- spec/integration/mongoid/extensions_spec.rb
|
|
357
323
|
- spec/integration/mongoid/finders_spec.rb
|
|
358
324
|
- spec/integration/mongoid/inheritance_spec.rb
|
|
359
325
|
- spec/integration/mongoid/named_scope_spec.rb
|
|
360
|
-
- spec/integration/mongoid/persistence/update_spec.rb
|
|
361
326
|
- spec/models/address.rb
|
|
362
327
|
- spec/models/animal.rb
|
|
363
|
-
- spec/models/callbacks.rb
|
|
364
328
|
- spec/models/comment.rb
|
|
365
329
|
- spec/models/country_code.rb
|
|
366
330
|
- spec/models/employer.rb
|
|
@@ -380,12 +344,11 @@ test_files:
|
|
|
380
344
|
- spec/models/vet_visit.rb
|
|
381
345
|
- spec/spec_helper.rb
|
|
382
346
|
- spec/unit/mongoid/associations/belongs_to_related_spec.rb
|
|
383
|
-
- spec/unit/mongoid/associations/
|
|
384
|
-
- spec/unit/mongoid/associations/embeds_many_spec.rb
|
|
385
|
-
- spec/unit/mongoid/associations/embeds_one_spec.rb
|
|
347
|
+
- spec/unit/mongoid/associations/belongs_to_spec.rb
|
|
386
348
|
- spec/unit/mongoid/associations/has_many_related_spec.rb
|
|
349
|
+
- spec/unit/mongoid/associations/has_many_spec.rb
|
|
387
350
|
- spec/unit/mongoid/associations/has_one_related_spec.rb
|
|
388
|
-
- spec/unit/mongoid/associations/
|
|
351
|
+
- spec/unit/mongoid/associations/has_one_spec.rb
|
|
389
352
|
- spec/unit/mongoid/associations/options_spec.rb
|
|
390
353
|
- spec/unit/mongoid/associations_spec.rb
|
|
391
354
|
- spec/unit/mongoid/attributes_spec.rb
|
|
@@ -405,23 +368,18 @@ test_files:
|
|
|
405
368
|
- spec/unit/mongoid/config_spec.rb
|
|
406
369
|
- spec/unit/mongoid/contexts/enumerable_spec.rb
|
|
407
370
|
- spec/unit/mongoid/contexts/mongo_spec.rb
|
|
408
|
-
- spec/unit/mongoid/contexts_spec.rb
|
|
409
371
|
- spec/unit/mongoid/criteria_spec.rb
|
|
410
372
|
- spec/unit/mongoid/criterion/complex_spec.rb
|
|
411
373
|
- spec/unit/mongoid/criterion/exclusion_spec.rb
|
|
412
374
|
- spec/unit/mongoid/criterion/inclusion_spec.rb
|
|
413
375
|
- spec/unit/mongoid/criterion/optional_spec.rb
|
|
414
376
|
- spec/unit/mongoid/cursor_spec.rb
|
|
415
|
-
- spec/unit/mongoid/deprecation_spec.rb
|
|
416
|
-
- spec/unit/mongoid/dirty_spec.rb
|
|
417
377
|
- spec/unit/mongoid/document_spec.rb
|
|
418
378
|
- spec/unit/mongoid/errors_spec.rb
|
|
419
379
|
- spec/unit/mongoid/extensions/array/accessors_spec.rb
|
|
420
380
|
- spec/unit/mongoid/extensions/array/assimilation_spec.rb
|
|
421
381
|
- spec/unit/mongoid/extensions/array/conversions_spec.rb
|
|
422
382
|
- spec/unit/mongoid/extensions/array/parentization_spec.rb
|
|
423
|
-
- spec/unit/mongoid/extensions/big_decimal/conversions_spec.rb
|
|
424
|
-
- spec/unit/mongoid/extensions/binary/conversions_spec.rb
|
|
425
383
|
- spec/unit/mongoid/extensions/boolean/conversions_spec.rb
|
|
426
384
|
- spec/unit/mongoid/extensions/date/conversions_spec.rb
|
|
427
385
|
- spec/unit/mongoid/extensions/datetime/conversions_spec.rb
|
|
@@ -439,14 +397,12 @@ test_files:
|
|
|
439
397
|
- spec/unit/mongoid/extensions/string/inflections_spec.rb
|
|
440
398
|
- spec/unit/mongoid/extensions/symbol/inflections_spec.rb
|
|
441
399
|
- spec/unit/mongoid/extensions/time/conversions_spec.rb
|
|
442
|
-
- spec/unit/mongoid/extras_spec.rb
|
|
443
400
|
- spec/unit/mongoid/factory_spec.rb
|
|
444
401
|
- spec/unit/mongoid/field_spec.rb
|
|
445
402
|
- spec/unit/mongoid/fields_spec.rb
|
|
446
403
|
- spec/unit/mongoid/finders_spec.rb
|
|
447
404
|
- spec/unit/mongoid/identity_spec.rb
|
|
448
405
|
- spec/unit/mongoid/indexes_spec.rb
|
|
449
|
-
- spec/unit/mongoid/javascript_spec.rb
|
|
450
406
|
- spec/unit/mongoid/matchers/all_spec.rb
|
|
451
407
|
- spec/unit/mongoid/matchers/default_spec.rb
|
|
452
408
|
- spec/unit/mongoid/matchers/exists_spec.rb
|
|
@@ -461,13 +417,7 @@ test_files:
|
|
|
461
417
|
- spec/unit/mongoid/matchers_spec.rb
|
|
462
418
|
- spec/unit/mongoid/memoization_spec.rb
|
|
463
419
|
- spec/unit/mongoid/named_scope_spec.rb
|
|
464
|
-
- spec/unit/mongoid/observable_spec.rb
|
|
465
|
-
- spec/unit/mongoid/paths_spec.rb
|
|
466
|
-
- spec/unit/mongoid/persistence/insert_spec.rb
|
|
467
|
-
- spec/unit/mongoid/persistence/update_spec.rb
|
|
468
|
-
- spec/unit/mongoid/persistence_spec.rb
|
|
469
420
|
- spec/unit/mongoid/scope_spec.rb
|
|
470
|
-
- spec/unit/mongoid/state_spec.rb
|
|
471
421
|
- spec/unit/mongoid/timestamps_spec.rb
|
|
472
422
|
- spec/unit/mongoid/validations/associated_spec.rb
|
|
473
423
|
- spec/unit/mongoid/validations/uniqueness_spec.rb
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
module Mongoid #:nodoc:
|
|
3
|
-
module Associations #:nodoc:
|
|
4
|
-
class MetaData #:nodoc:
|
|
5
|
-
|
|
6
|
-
attr_reader :association, :options
|
|
7
|
-
|
|
8
|
-
delegate :macro, :to => :association
|
|
9
|
-
|
|
10
|
-
# Delegate all methods on +Options+ to the options instance.
|
|
11
|
-
Associations::Options.public_instance_methods(false).each do |name|
|
|
12
|
-
define_method(name) { |*args| @options.send(name) }
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
# Create the new associations MetaData object, which holds the type of
|
|
16
|
-
# the association and its options, with convenience methods for getting
|
|
17
|
-
# that information.
|
|
18
|
-
#
|
|
19
|
-
# Options:
|
|
20
|
-
#
|
|
21
|
-
# association: The association type as a class instance.
|
|
22
|
-
# options: The association options
|
|
23
|
-
def initialize(association, options)
|
|
24
|
-
@association, @options = association, options
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
data/lib/mongoid/contexts/ids.rb
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
module Mongoid #:nodoc:
|
|
3
|
-
module Contexts #:nodoc:
|
|
4
|
-
module Ids
|
|
5
|
-
# Return documents based on an id search. Will handle if a single id has
|
|
6
|
-
# been passed or mulitple ids.
|
|
7
|
-
#
|
|
8
|
-
# Example:
|
|
9
|
-
#
|
|
10
|
-
# context.id_criteria([1, 2, 3])
|
|
11
|
-
#
|
|
12
|
-
# Returns:
|
|
13
|
-
#
|
|
14
|
-
# The single or multiple documents.
|
|
15
|
-
def id_criteria(params)
|
|
16
|
-
criteria.id(params)
|
|
17
|
-
result = params.is_a?(Array) ? criteria.entries : one
|
|
18
|
-
if Mongoid.raise_not_found_error
|
|
19
|
-
raise Errors::DocumentNotFound.new(klass, params) if result.blank?
|
|
20
|
-
end
|
|
21
|
-
return result
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
data/lib/mongoid/deprecation.rb
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
module Mongoid #:nodoc:
|
|
3
|
-
class Deprecation #:nodoc
|
|
4
|
-
include Singleton
|
|
5
|
-
|
|
6
|
-
# Alert of a deprecation. This will delegate to the logger and call warn on
|
|
7
|
-
# it.
|
|
8
|
-
#
|
|
9
|
-
# Example:
|
|
10
|
-
#
|
|
11
|
-
# <tt>deprecation.alert("Method no longer used")</tt>
|
|
12
|
-
def alert(message)
|
|
13
|
-
@logger.warn("Deprecation: #{message}")
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
protected
|
|
17
|
-
# Instantiate a new logger to stdout or a rails logger if available.
|
|
18
|
-
def initialize
|
|
19
|
-
@logger = defined?(Rails) ? Rails.logger : Logger.new($stdout)
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
data/lib/mongoid/dirty.rb
DELETED
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
module Mongoid #:nodoc:
|
|
3
|
-
module Dirty #:nodoc:
|
|
4
|
-
extend ActiveSupport::Concern
|
|
5
|
-
module InstanceMethods #:nodoc:
|
|
6
|
-
# Gets the changes for a specific field.
|
|
7
|
-
#
|
|
8
|
-
# Example:
|
|
9
|
-
#
|
|
10
|
-
# person = Person.new(:title => "Sir")
|
|
11
|
-
# person.title = "Madam"
|
|
12
|
-
# person.attribute_change("title") # [ "Sir", "Madam" ]
|
|
13
|
-
#
|
|
14
|
-
# Returns:
|
|
15
|
-
#
|
|
16
|
-
# An +Array+ containing the old and new values.
|
|
17
|
-
def attribute_change(name)
|
|
18
|
-
@modifications[name]
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
# Determines if a specific field has chaged.
|
|
22
|
-
#
|
|
23
|
-
# Example:
|
|
24
|
-
#
|
|
25
|
-
# person = Person.new(:title => "Sir")
|
|
26
|
-
# person.title = "Madam"
|
|
27
|
-
# person.attribute_changed?("title") # true
|
|
28
|
-
#
|
|
29
|
-
# Returns:
|
|
30
|
-
#
|
|
31
|
-
# +true+ if changed, +false+ if not.
|
|
32
|
-
def attribute_changed?(name)
|
|
33
|
-
@modifications.include?(name)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
# Gets the old value for a specific field.
|
|
37
|
-
#
|
|
38
|
-
# Example:
|
|
39
|
-
#
|
|
40
|
-
# person = Person.new(:title => "Sir")
|
|
41
|
-
# person.title = "Madam"
|
|
42
|
-
# person.attribute_was("title") # "Sir"
|
|
43
|
-
#
|
|
44
|
-
# Returns:
|
|
45
|
-
#
|
|
46
|
-
# The old field value.
|
|
47
|
-
def attribute_was(name)
|
|
48
|
-
change = @modifications[name]
|
|
49
|
-
change ? change[0] : nil
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
# Gets the names of all the fields that have changed in the document.
|
|
53
|
-
#
|
|
54
|
-
# Example:
|
|
55
|
-
#
|
|
56
|
-
# person = Person.new(:title => "Sir")
|
|
57
|
-
# person.title = "Madam"
|
|
58
|
-
# person.changed # returns [ "title" ]
|
|
59
|
-
#
|
|
60
|
-
# Returns:
|
|
61
|
-
#
|
|
62
|
-
# An +Array+ of changed field names.
|
|
63
|
-
def changed
|
|
64
|
-
@modifications.keys
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
# Alerts to whether the document has been modified or not.
|
|
68
|
-
#
|
|
69
|
-
# Example:
|
|
70
|
-
#
|
|
71
|
-
# person = Person.new(:title => "Sir")
|
|
72
|
-
# person.title = "Madam"
|
|
73
|
-
# person.changed? # returns true
|
|
74
|
-
#
|
|
75
|
-
# Returns:
|
|
76
|
-
#
|
|
77
|
-
# +true+ if changed, +false+ if not.
|
|
78
|
-
def changed?
|
|
79
|
-
!@modifications.empty?
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
# Gets all the modifications that have happened to the object as a +Hash+
|
|
83
|
-
# with the keys being the names of the fields, and the values being an
|
|
84
|
-
# +Array+ with the old value and new value.
|
|
85
|
-
#
|
|
86
|
-
# Example:
|
|
87
|
-
#
|
|
88
|
-
# person = Person.new(:title => "Sir")
|
|
89
|
-
# person.title = "Madam"
|
|
90
|
-
# person.changes # returns { "title" => [ "Sir", "Madam" ] }
|
|
91
|
-
#
|
|
92
|
-
# Returns:
|
|
93
|
-
#
|
|
94
|
-
# A +Hash+ of changes.
|
|
95
|
-
def changes
|
|
96
|
-
@modifications
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
# Call this method after save, so the changes can be properly switched.
|
|
100
|
-
#
|
|
101
|
-
# Example:
|
|
102
|
-
#
|
|
103
|
-
# <tt>person.move_changes</tt>
|
|
104
|
-
def move_changes
|
|
105
|
-
@previous_modifications = @modifications.dup
|
|
106
|
-
@modifications = {}
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
# Gets all the new values for each of the changed fields, to be passed to
|
|
110
|
-
# a MongoDB $set modifier.
|
|
111
|
-
#
|
|
112
|
-
# Example:
|
|
113
|
-
#
|
|
114
|
-
# person = Person.new(:title => "Sir")
|
|
115
|
-
# person.title = "Madam"
|
|
116
|
-
# person.setters # returns { "title" => "Madam" }
|
|
117
|
-
#
|
|
118
|
-
# Returns:
|
|
119
|
-
#
|
|
120
|
-
# A +Hash+ of new values.
|
|
121
|
-
def setters
|
|
122
|
-
@modifications.inject({}) do |sets, (field, changes)|
|
|
123
|
-
key = embedded ? "#{position}.#{field}" : field
|
|
124
|
-
sets[key] = changes[1]; sets
|
|
125
|
-
end
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
# Gets all the modifications that have happened to the object before the
|
|
129
|
-
# object was saved.
|
|
130
|
-
#
|
|
131
|
-
# Example:
|
|
132
|
-
#
|
|
133
|
-
# person = Person.new(:title => "Sir")
|
|
134
|
-
# person.title = "Madam"
|
|
135
|
-
# person.save!
|
|
136
|
-
# person.previous_changes # returns { "title" => [ "Sir", "Madam" ] }
|
|
137
|
-
#
|
|
138
|
-
# Returns:
|
|
139
|
-
#
|
|
140
|
-
# A +Hash+ of changes before save.
|
|
141
|
-
def previous_changes
|
|
142
|
-
@previous_modifications
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
# Resets a changed field back to its old value.
|
|
146
|
-
#
|
|
147
|
-
# Example:
|
|
148
|
-
#
|
|
149
|
-
# person = Person.new(:title => "Sir")
|
|
150
|
-
# person.title = "Madam"
|
|
151
|
-
# person.reset_attribute!("title")
|
|
152
|
-
# person.title # "Sir"
|
|
153
|
-
#
|
|
154
|
-
# Returns:
|
|
155
|
-
#
|
|
156
|
-
# The old field value.
|
|
157
|
-
def reset_attribute!(name)
|
|
158
|
-
value = attribute_was(name)
|
|
159
|
-
if value
|
|
160
|
-
@attributes[name] = value
|
|
161
|
-
@modifications.delete(name)
|
|
162
|
-
end
|
|
163
|
-
end
|
|
164
|
-
|
|
165
|
-
# Sets up the modifications hash. This occurs just after the document is
|
|
166
|
-
# instantiated.
|
|
167
|
-
#
|
|
168
|
-
# Example:
|
|
169
|
-
#
|
|
170
|
-
# <tt>document.setup_notifications</tt>
|
|
171
|
-
def setup_modifications
|
|
172
|
-
@modifications ||= {}
|
|
173
|
-
@previous_modifications ||= {}
|
|
174
|
-
end
|
|
175
|
-
|
|
176
|
-
protected
|
|
177
|
-
# Audit the change of a field's value.
|
|
178
|
-
def modify(name, old_value, new_value)
|
|
179
|
-
@attributes[name] = new_value
|
|
180
|
-
@modifications[name] = [ old_value, new_value ] if @modifications
|
|
181
|
-
end
|
|
182
|
-
end
|
|
183
|
-
module ClassMethods #:nodoc:
|
|
184
|
-
# Add the dynamic dirty methods. These are custom methods defined on a
|
|
185
|
-
# field by field basis that wrap the dirty attribute methods.
|
|
186
|
-
#
|
|
187
|
-
# Example:
|
|
188
|
-
#
|
|
189
|
-
# person = Person.new(:title => "Sir")
|
|
190
|
-
# person.title = "Madam"
|
|
191
|
-
# person.title_change # [ "Sir", "Madam" ]
|
|
192
|
-
# person.title_changed? # true
|
|
193
|
-
# person.title_was # "Sir"
|
|
194
|
-
# person.reset_title!
|
|
195
|
-
def add_dirty_methods(name)
|
|
196
|
-
define_method("#{name}_change") { attribute_change(name) }
|
|
197
|
-
define_method("#{name}_changed?") { attribute_changed?(name) }
|
|
198
|
-
define_method("#{name}_was") { attribute_was(name) }
|
|
199
|
-
define_method("reset_#{name}!") { reset_attribute!(name) }
|
|
200
|
-
end
|
|
201
|
-
end
|
|
202
|
-
end
|
|
203
|
-
end
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
require "bigdecimal"
|
|
3
|
-
|
|
4
|
-
module Mongoid #:nodoc:
|
|
5
|
-
module Extensions #:nodoc:
|
|
6
|
-
module BigDecimal #:nodoc:
|
|
7
|
-
module Conversions #:nodoc:
|
|
8
|
-
# Get the string as a +BigDecimal+
|
|
9
|
-
def get(value)
|
|
10
|
-
::BigDecimal.new(value)
|
|
11
|
-
end
|
|
12
|
-
# Set the value in the hash as a string.
|
|
13
|
-
def set(value)
|
|
14
|
-
value.to_s
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
module Mongoid #:nodoc:
|
|
3
|
-
module Extensions #:nodoc:
|
|
4
|
-
module Binary #:nodoc:
|
|
5
|
-
module Conversions #:nodoc:
|
|
6
|
-
# Get the value from the db hash.
|
|
7
|
-
def get(value)
|
|
8
|
-
value
|
|
9
|
-
end
|
|
10
|
-
# Set the value in the db hash.
|
|
11
|
-
def set(value)
|
|
12
|
-
value
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
data/lib/mongoid/extras.rb
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
module Mongoid #:nodoc:
|
|
3
|
-
module Extras #:nodoc:
|
|
4
|
-
extend ActiveSupport::Concern
|
|
5
|
-
included do
|
|
6
|
-
class_inheritable_accessor :cached, :enslaved
|
|
7
|
-
self.cached = false
|
|
8
|
-
self.enslaved = false
|
|
9
|
-
delegate :cached?, :enslaved?, :to => "self.class"
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
module ClassMethods #:nodoc
|
|
13
|
-
# Sets caching on for this class. This class level configuration will
|
|
14
|
-
# default all queries to cache the results of the first iteration over
|
|
15
|
-
# the cursor into an internal array. This should only be used for queries
|
|
16
|
-
# that return a small number of results or have small documents, as after
|
|
17
|
-
# the first iteration the entire results will be stored in memory.
|
|
18
|
-
#
|
|
19
|
-
# Example:
|
|
20
|
-
#
|
|
21
|
-
# class Person
|
|
22
|
-
# include Mongoid::Document
|
|
23
|
-
# cache
|
|
24
|
-
# end
|
|
25
|
-
def cache
|
|
26
|
-
self.cached = true
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
# Determines if the class is cached or not.
|
|
30
|
-
#
|
|
31
|
-
# Returns:
|
|
32
|
-
#
|
|
33
|
-
# True if cached, false if not.
|
|
34
|
-
def cached?
|
|
35
|
-
!!self.cached
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
# Set whether or not this documents read operations should delegate to
|
|
39
|
-
# the slave database by default.
|
|
40
|
-
#
|
|
41
|
-
# Example:
|
|
42
|
-
#
|
|
43
|
-
# class Person
|
|
44
|
-
# include Mongoid::Document
|
|
45
|
-
# enslave
|
|
46
|
-
# end
|
|
47
|
-
def enslave
|
|
48
|
-
self.enslaved = true
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
# Determines if the class is enslaved or not.
|
|
52
|
-
#
|
|
53
|
-
# Returns:
|
|
54
|
-
#
|
|
55
|
-
# True if enslaved, false if not.
|
|
56
|
-
def enslaved?
|
|
57
|
-
!!self.enslaved
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
end
|