mongoid 2.4.11 → 2.4.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,22 @@
3
3
  For instructions on upgrading to newer versions, visit
4
4
  [mongoid.org](http://mongoid.org/docs/upgrading.html).
5
5
 
6
- ## 2.4.11 (branch: 2.4.0-stable)
6
+ ## 2.4.12
7
+
8
+ ### Resolved Issues
9
+
10
+ * \#2178 Ensure destroy callbacks are run post replacement of an embeds one
11
+ relation.
12
+
13
+ * \#2169 Allow saves to pass when documents are destroyed after the save
14
+ in a callback.
15
+
16
+ * \#2144 Uniqueness validation on paranoid documents now properly scopes.
17
+
18
+ * \#2127 Don't unbind parents of embedded documents mid nested
19
+ attributes deletion.
20
+
21
+ ## 2.4.11
7
22
 
8
23
  ### Resolved Issues
9
24
 
@@ -151,7 +151,7 @@ module Mongoid #:nodoc:
151
151
  # @return [ true, false ] True is success, false if not.
152
152
  def upsert(options = {})
153
153
  if new_record?
154
- insert(options).persisted?
154
+ !insert(options).new_record?
155
155
  else
156
156
  update(options)
157
157
  end
@@ -197,8 +197,8 @@ module Mongoid # :nodoc:
197
197
  end
198
198
  else
199
199
  doc.delete(:suppress => true)
200
+ unbind_one(doc)
200
201
  end
201
- unbind_one(doc)
202
202
  end
203
203
  reindex
204
204
  end
@@ -309,7 +309,7 @@ module Mongoid # :nodoc:
309
309
  proxy.clear
310
310
  else
311
311
  atomically(:$set) do
312
- base.delayed_atomic_sets.clear
312
+ base.delayed_atomic_sets.clear unless _assigning?
313
313
  if replacement.first.is_a?(Hash)
314
314
  replacement = replacement.map do |doc|
315
315
  attributes = { :metadata => metadata, :_parent => base }
@@ -327,6 +327,7 @@ module Mongoid # :nodoc:
327
327
  end
328
328
  if _assigning?
329
329
  name = _unscoped.first.atomic_path
330
+ base.delayed_atomic_sets[name].try(:clear)
330
331
  base._children.each do |child|
331
332
  child.delayed_atomic_sets.clear
332
333
  end
@@ -39,7 +39,7 @@ module Mongoid # :nodoc:
39
39
  if _assigning?
40
40
  base.atomic_unsets.push(proxy.atomic_path)
41
41
  else
42
- proxy.delete if persistable?
42
+ proxy.destroy if persistable?
43
43
  end
44
44
  proxy.unbind_one
45
45
  return nil unless replacement
@@ -101,7 +101,7 @@ module Mongoid #:nodoc:
101
101
  # @since 2.4.10
102
102
  def create_criteria(base, document, attribute, value)
103
103
  field = document.fields[attribute.to_s]
104
- criteria = base.unscoped
104
+ criteria = base.paranoid ? base.unscoped.where(:deleted_at => nil) : base.unscoped
105
105
  if field.try(:localized?)
106
106
  criterion(document, attribute, value).each_pair do |key, value|
107
107
  criteria.selector.store(key, value)
@@ -167,6 +167,7 @@ module Mongoid #:nodoc:
167
167
  Array.wrap(options[:scope]).each do |item|
168
168
  criteria = criteria.where(item => document.attributes[item.to_s])
169
169
  end
170
+ criteria = criteria.where(:deleted_at => nil) if document.paranoid?
170
171
  criteria
171
172
  end
172
173
 
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Mongoid #:nodoc
3
- VERSION = "2.4.11"
3
+ VERSION = "2.4.12"
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: 2.4.11
4
+ version: 2.4.12
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: 2012-06-06 00:00:00.000000000 Z
12
+ date: 2012-07-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel
@@ -80,17 +80,17 @@ dependencies:
80
80
  requirement: !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
83
- - - ~>
83
+ - - '='
84
84
  - !ruby/object:Gem::Version
85
- version: '0.10'
85
+ version: '0.11'
86
86
  type: :development
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
89
89
  none: false
90
90
  requirements:
91
- - - ~>
91
+ - - '='
92
92
  - !ruby/object:Gem::Version
93
- version: '0.10'
93
+ version: '0.11'
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: rspec
96
96
  requirement: !ruby/object:Gem::Requirement
@@ -429,7 +429,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
429
429
  version: '0'
430
430
  segments:
431
431
  - 0
432
- hash: 4531209101708295137
432
+ hash: 1387804886696110534
433
433
  required_rubygems_version: !ruby/object:Gem::Requirement
434
434
  none: false
435
435
  requirements: