mongoid 3.1.1 → 3.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +34 -2
- data/lib/mongoid/attributes.rb +1 -1
- data/lib/mongoid/contextual/mongo.rb +3 -0
- data/lib/mongoid/extensions/array.rb +5 -1
- data/lib/mongoid/extensions/string.rb +1 -1
- data/lib/mongoid/hierarchy.rb +1 -0
- data/lib/mongoid/persistence.rb +1 -1
- data/lib/mongoid/relations/embedded/batchable.rb +1 -1
- data/lib/mongoid/relations/marshalable.rb +1 -0
- data/lib/mongoid/validations/uniqueness.rb +19 -2
- data/lib/mongoid/version.rb +1 -1
- metadata +2 -2
data/CHANGELOG.md
CHANGED
@@ -3,16 +3,30 @@
|
|
3
3
|
For instructions on upgrading to newer versions, visit
|
4
4
|
[mongoid.org](http://mongoid.org/en/mongoid/docs/upgrading.html).
|
5
5
|
|
6
|
+
## 3.1.2
|
7
|
+
|
8
|
+
### Resolved Issues
|
9
|
+
|
10
|
+
* \#2851 Fixed BigDecimal demongoization of NaN values. (nkem)
|
11
|
+
|
12
|
+
* \#2848 Fixed `touch` to work when usinng short timestamps. (Arthur Neves)
|
13
|
+
|
14
|
+
* \#2840 Fixed end-to-end `no_timeout` option handling.
|
15
|
+
|
16
|
+
* \#2826 Dynamic fields are now properly mongoized.
|
17
|
+
|
18
|
+
* \#2822 Marshal load of relations now properly reapplies extensions.
|
19
|
+
|
6
20
|
## 3.1.1
|
7
21
|
|
22
|
+
### Resolved Issues
|
23
|
+
|
8
24
|
* \#2839 Validations fixed to use the type cast value with the exception
|
9
25
|
of the numericality validator. (Lailson Bandeira)
|
10
26
|
|
11
27
|
* \#2838 `store_in` options now properly merge instead of override.
|
12
28
|
(Colin MacKenzie)
|
13
29
|
|
14
|
-
### Resolved Issues
|
15
|
-
|
16
30
|
## 3.1.0
|
17
31
|
|
18
32
|
### New Features
|
@@ -275,6 +289,24 @@ For instructions on upgrading to newer versions, visit
|
|
275
289
|
* \#2664 In memory sorting of embedded documents now properly works when
|
276
290
|
multiple fields are provided. (Neer Friedman)
|
277
291
|
|
292
|
+
## 3.0.23
|
293
|
+
|
294
|
+
### Resolved Issues
|
295
|
+
|
296
|
+
* \#2851 Fixed BigDecimal demongoization of NaN values. (nkem)
|
297
|
+
|
298
|
+
* \#2841 Calling `delete_all` or `destroy_all` on an embeds many when in the
|
299
|
+
middle of a parent update will now properly execute the deletion.
|
300
|
+
(Arthur Neves)
|
301
|
+
|
302
|
+
* \#2835 Fixed clearing of persistence options in uniqueness validator.
|
303
|
+
|
304
|
+
* \#2826 Dynamic fields are now properly mongoized.
|
305
|
+
|
306
|
+
* \#2822 Marshal load of relations now properly reapplies extensions.
|
307
|
+
|
308
|
+
* \#2821 Autosaved relations should be duped in inheriting classes.
|
309
|
+
|
278
310
|
## 3.0.22
|
279
311
|
|
280
312
|
### Resolved Issues
|
data/lib/mongoid/attributes.rb
CHANGED
@@ -153,7 +153,11 @@ module Mongoid
|
|
153
153
|
#
|
154
154
|
# @since 3.0.0
|
155
155
|
def mongoize(object)
|
156
|
-
|
156
|
+
if object.is_a?(::Array)
|
157
|
+
evolve(object).collect{ |obj| obj.class.mongoize(obj) }
|
158
|
+
else
|
159
|
+
evolve(object)
|
160
|
+
end
|
157
161
|
end
|
158
162
|
|
159
163
|
# Is the object's size changable?
|
data/lib/mongoid/hierarchy.rb
CHANGED
@@ -173,6 +173,7 @@ module Mongoid
|
|
173
173
|
subclass.pre_processed_defaults = pre_processed_defaults.dup
|
174
174
|
subclass.post_processed_defaults = post_processed_defaults.dup
|
175
175
|
subclass.scopes = scopes.dup
|
176
|
+
subclass.autosaved_relations = autosaved_relations.dup
|
176
177
|
|
177
178
|
# We only need the _type field if inheritance is in play, but need to
|
178
179
|
# add to the root class as well for backwards compatibility.
|
data/lib/mongoid/persistence.rb
CHANGED
@@ -120,7 +120,7 @@ module Mongoid
|
|
120
120
|
def touch(field = nil)
|
121
121
|
return false if _root.new_record?
|
122
122
|
current = Time.now
|
123
|
-
write_attribute(:updated_at, current) if
|
123
|
+
write_attribute(:updated_at, current) if respond_to?("updated_at=")
|
124
124
|
write_attribute(field, current) if field
|
125
125
|
|
126
126
|
touches = touch_atomic_updates(field)
|
@@ -56,7 +56,7 @@ module Mongoid
|
|
56
56
|
# @since 3.0.0
|
57
57
|
def batch_remove(docs, method = :delete)
|
58
58
|
removals = pre_process_batch_remove(docs, method)
|
59
|
-
if !docs.empty?
|
59
|
+
if !docs.empty?
|
60
60
|
collection.find(selector).update(
|
61
61
|
positionally(selector, "$pullAll" => { path => removals })
|
62
62
|
)
|
@@ -266,8 +266,8 @@ module Mongoid
|
|
266
266
|
#
|
267
267
|
# @since 2.4.10
|
268
268
|
def validate_root(document, attribute, value)
|
269
|
-
criteria = create_criteria(klass, document, attribute, value)
|
270
|
-
if criteria.with(
|
269
|
+
criteria = create_criteria(klass || document.class, document, attribute, value)
|
270
|
+
if criteria.with(persistence_options(criteria)).exists?
|
271
271
|
add_error(document, attribute, value)
|
272
272
|
end
|
273
273
|
end
|
@@ -288,6 +288,23 @@ module Mongoid
|
|
288
288
|
document.send("attribute_changed?", attribute.to_s) ||
|
289
289
|
scope_value_changed?(document)
|
290
290
|
end
|
291
|
+
|
292
|
+
# Get the persistence options to perform to check, merging with any
|
293
|
+
# existing.
|
294
|
+
#
|
295
|
+
# @api private
|
296
|
+
#
|
297
|
+
# @example Get the persistence options.
|
298
|
+
# validator.persistence_options(criteria)
|
299
|
+
#
|
300
|
+
# @param [ Criteria ] criteria The criteria.
|
301
|
+
#
|
302
|
+
# @return [ Hash ] The persistence options.
|
303
|
+
#
|
304
|
+
# @since 3.0.23
|
305
|
+
def persistence_options(criteria)
|
306
|
+
(criteria.klass.persistence_options || {}).merge!(consistency: :strong)
|
307
|
+
end
|
291
308
|
end
|
292
309
|
end
|
293
310
|
end
|
data/lib/mongoid/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|