mongoid 3.1.1 → 3.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -342,7 +342,7 @@ module Mongoid
342
342
  #
343
343
  # @since 1.0.0
344
344
  def typed_value_for(key, value)
345
- fields.has_key?(key) ? fields[key].mongoize(value) : value
345
+ fields.has_key?(key) ? fields[key].mongoize(value) : value.mongoize
346
346
  end
347
347
 
348
348
  module ClassMethods
@@ -466,6 +466,9 @@ module Mongoid
466
466
  [ :hint, :limit, :skip, :sort, :batch_size, :max_scan ].each do |name|
467
467
  apply_option(name)
468
468
  end
469
+ if criteria.options[:timeout] == false
470
+ query.no_timeout
471
+ end
469
472
  end
470
473
 
471
474
  # Apply an option.
@@ -153,7 +153,11 @@ module Mongoid
153
153
  #
154
154
  # @since 3.0.0
155
155
  def mongoize(object)
156
- evolve(object)
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?
@@ -81,7 +81,7 @@ module Mongoid
81
81
  #
82
82
  # @since 3.0.0
83
83
  def numeric?
84
- true if Float(self) rescue false
84
+ true if Float(self) rescue (self == "NaN")
85
85
  end
86
86
 
87
87
  # Get the string as a getter string.
@@ -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.
@@ -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 fields["updated_at"]
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? && !_assigning?
59
+ if !docs.empty?
60
60
  collection.find(selector).update(
61
61
  positionally(selector, "$pullAll" => { path => removals })
62
62
  )
@@ -25,6 +25,7 @@ module Mongoid
25
25
  # @since 3.0.15
26
26
  def marshal_load(data)
27
27
  @base, @target, @metadata = data
28
+ extend_proxy(metadata.extension) if metadata.extension?
28
29
  end
29
30
  end
30
31
  end
@@ -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(consistency: :strong).exists?
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
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Mongoid
3
- VERSION = "3.1.1"
3
+ VERSION = "3.1.2"
4
4
  end
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.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-17 00:00:00.000000000 Z
12
+ date: 2013-02-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel