Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 1525 lines (965 sloc) 52.378 kB
a11cc27 @gmile Changelog: rdoc -> md
gmile authored
1 # Overview
2
87a1d4a @durran Fix eager loading to load all relations passed to includes. Fixes #1295.
durran authored
3 For instructions on upgrading to newer versions, visit
4 [mongoid.org](http://mongoid.org/docs/upgrading.html).
a11cc27 @gmile Changelog: rdoc -> md
gmile authored
5
6bb9203 @durran Update changelog
durran authored
6 ## 3.0.0 (branch: master)
4cdc72c @durran Remove custom primary keys, identity class:
durran authored
7
8 ### New Features
9
c068fee @durran Ensure all relations push methods can be chainable. Closes #1856
durran authored
10 * \#1856 Push on one to many relations can now be chained.
11
12 band.albums.push(undertow).push(aenima)
13
a01e166 @durran Update changelog
durran authored
14 * \#1842 MultiParameterAttributes now supported aliased fields.
15 (Anton Orel)
16
fef6538 @durran Raise a NoParent error when saving an orphaned embedded doc. Closes #…
durran authored
17 * \#1833 If an embedded document is attempted to be saved with no
18 parent defined, Mongoid now will raise a `Mongoid::Errors::NoParent`
19 exception.
20
8f39798 @cgriego Add Document.attribute_names
cgriego authored
21 * Added an ORM-agnostic way to get the field names
22
23 class Band
24 include Mongoid::Document
25 field :name, type: String
26 end
27
28 Band.attribute_names
29
3b82d26 @durran refactor spec and update changelog
durran authored
30 * \#1831 `find_or_create_by` on relations now takes mass assignment
31 and type options. (Tatsuya Ono)
32
33 class Band
34 include Mongoid::Document
35 embeds_many :albums
36 end
37
38 band.albums.find_or_create_by({ name: "101" }, LP)
39
bf0583c @durran Update changelog and restrict error messages
durran authored
40 * \#1774 Relations now have a :restrict option for dependent relations
41 which will raise an error when attempting to delete a parent that
42 still has children on it. (Hans Hasselberg)
43
44 class Band
45 include Mongoid::Document
46 has_many :albums, dependent: :restrict
47 end
48
49 band = Band.first
50 band.albums << Albums.first
51 band.delete # Raises DeleteRestriction error.
52
bfb4a28 @durran Add Model#attribute_changed_from_default?. Closes #1764.
durran authored
53 * \#1764 Add method to check if field differs from the default value.
54
55 class Band
56 include Mongoid::Document
57 field :name, type: String, default: "New"
58 end
59
60 band = Band.first
61 band.name_changed_from_default?
62
f295cdc @durran Update InvalidField error message with source location. Closes #1759.
durran authored
63 * \#1759 Invalid fields error messages have been updated to show the
64 source and location of the original method. The new message is:
65
66 Problem:
67 Defining a field named 'crazy_method' is not allowed.
68 Summary:
69 Defining this field would override the method 'crazy_method',
70 which would cause issues with expectations around the original
71 method and cause extremely hard to debug issues.
72 The original method was defined in:
73 Object: MyModule
74 File: /path/to/my/module.rb
75 Line: 8
76 Resolution:
77 Use Mongoid.destructive_fields to see what names are
78 not allowed, and don't use these names. These include names
79 that also conflict with core Ruby methods on Object, Module,
80 Enumerable, or included gems that inject methods into these
81 or Mongoid internals.
82
3cb5690 @durran Remove conditional, update changelog
durran authored
83 * \#1753/#1649 A setter and getter for has_many relations to set it's
84 children is now provided. (Piotr Jakubowski)
85
86 class Album
87 include Mongoid::Document
88 has_many :engineers
89 end
90
91 class Engineer
92 include Mongoid::Document
93 belongs_to :album
94 end
95
96 album = Album.first
97 engineer = Engineer.first
98 album.engineer_ids = [ engineer.id ]
99 album.engineer_ids # Returns the ids of the engineers.
100
128b895 @durran Update changelog
durran authored
101 * \#1741 Mongoid now provides a rake task to force remove indexes for
102 environments where Mongoid manages the index definitions and the
103 removal should be automated. (Hans Hasselberg)
104
105 rake db:force_remove_indexes
106 rake db:mongoid:force_remove_indexes
107
b3d76bf @durran Allow passing of environment to Mongoid.load. Closes #1726
durran authored
108 * \#1726 `Mongoid.load!` now accepts an optional second argument for the
109 environment to load. This takes precedence over any environment variable
110 that is set if provided.
111
112 Mongoid.load!("/path/to/mongoid.yml", :development)
113
f0e920d @durran Add regexp field support. Closes #1724.
durran authored
114 * \#1724 Mongoid now supports regex fields.
115
116 class Rule
117 include Mongoid::Document
118 field :pattern, type: Regexp, default: /[^abc]/
119 end
120
c827f79 @durran Update logging messages and changelog
durran authored
121 * \#1714/\#1706 Added better logging on index creation. (Hans Hasselberg)
122
123 When an index is present on a root document model:
124
125 Creating indexes on: Model for: name, dob.
126
127 When an index is defined on an embedded model:
128
129 Index ignored on: Address, please define in the root model.
130
131 When no index is defined, nothing is logged, and if a bad index is
132 defined an error is raised.
133
d4dab70 @durran Allow auto-protection of id and type to be configurable. Closes #1710
durran authored
134 * \#1710 For cases when you don't want Mongoid to auto-protect the id
135 and type attributes, you can set a configuration option to turn this
136 off.
137
138 Mongoid.protect_sensitive_fields = false
139
76b9d23 @durran Belongs to relations now have build_ and create_ methods. Closes #1685.
durran authored
140 * \#1685 Belongs to relations now have build_ and create_ methods.
141
a7ebf2e @durran Getting a bit more descriptive with examples in 3.0 changelog
durran authored
142 class Comment
143 include Mongoid::Document
144 belongs_to :user
145 end
146
147 comment = Comment.new
148 comment.build_user # Build a new user object
149 comment.create_user # Create a new user object
150
11c6a51 @durran Raise InverseNotFound when not able to bind the inverse relation. Fix…
durran authored
151 * \#1684 Raise a `Mongoid::Errors::InverseNotFound` when attempting to
152 set a child on a relation without the proper inverse_of definitions
153 due to Mongoid not being able to determine it.
154
b238df0 @durran Updating changelog with more descriptive entries for 3.0 features
durran authored
155 class Lush
156 include Mongoid::Document
157 embeds_one :whiskey, class_name: "Drink"
158 end
159
160 class Drink
161 include Mongoid::Document
162 embedded_in :alcoholic, class_name: "Lush"
163 end
164
165 lush = Lush.new
166 lush.whiskey = Drink.new # raises an InverseNotFound error.
167
c0f6e01 @durran Last change was actually an optimization
durran authored
168 * \#1680 Polymorphic relations now use `*_type` keys in lookup queries.
169
b238df0 @durran Updating changelog with more descriptive entries for 3.0 features
durran authored
170 class User
171 include Mongoid::Document
172 has_many :comments, as: :commentable
173 end
174
175 class Comment
176 include Mongoid::Document
177 belongs_to :commentable, polymorphic: true
178 end
179
180 user = User.find(id)
181 user.comments # Uses user.id and type "User" in the query.
182
f94256d @durran Update changelog
durran authored
183 * \#1677 Support for parent separable polymorphic relations to the same
184 parent class is now available. This only works if set from the parent
185 side in order to know which relation the children belong to.
186 (Douwe Maan)
187
188 class Face
189 include Mongoid::Document
190 has_one :left_eye, class_name: "Eye", as: :visible
191 has_one :right_eye, class_name: "Eye", as: :visible
192 end
193
194 class Eye
195 include Mongoid::Document
196 belongs_to :visible, polymorphic: true
197 end
198
199 face = Face.new
200 right_eye = Eye.new
201 left_eye = Eye.new
202 face.right_eye = right_eye
203 face.left_eye = left_eye
754facf @DouweM Fix typo in changelog.
DouweM authored
204 right_eye.visible = face # Will raise an error.
f94256d @durran Update changelog
durran authored
205
219dd76 @durran Fix changelog formatting
durran authored
206 * \#1650 Objects that respond to `to_criteria` can now be merged into
7ab9d1b @durran Objects that respond to #to_criteria can merge into criteria. Closes …
durran authored
207 existing criteria objects.
208
b238df0 @durran Updating changelog with more descriptive entries for 3.0 features
durran authored
209 class Filter
210 def to_criteria
211 # return a Criteria object.
212 end
213 end
214
215 criteria = Person.where(title: "Sir")
216 criteria.merge(filter)
217
25a43e1 @durran Provide more comprehensive error messages. Closes #1635
durran authored
218 * \#1635 All exceptions now provide more comprehensive errors, including
219 the problem that occured, a detail summary of why it happened, and
7cc71a7 @durran Update changelog to show example of new errors
durran authored
220 potential resolutions. Example:
221
222 (Mongoid::Errors::DocumentNotFound)
223 Problem:
224 Document not found for class Town with
225 id(s) [BSON::ObjectId('4f35781b8ad54812e1000001')].
226 Summary:
227 When calling Town.find with an id or array of ids,
228 each parameter must match a document in the database
229 or this error will be raised.
230 Resolution:
231 Search for an id that is in the database or set the
232 Mongoid.raise_not_found_error configuration option to
233 false, which will cause a nil to be returned instead
234 of raising this error.
25a43e1 @durran Provide more comprehensive error messages. Closes #1635
durran authored
235
abcd57f @durran Merging in #1616
durran authored
236 * \#1616 `Model.find_by` added which takes a hash of arugments to search
237 for in the database. If no single document is returned a DocumentNotFound
238 error is raised. (Piotr Jakubowski)
239
a7ebf2e @durran Getting a bit more descriptive with examples in 3.0 changelog
durran authored
240 Band.find_by(name: "Depeche Mode")
241
cf8170d @durran Adding nested attributes macros now enables autosave for relations. C…
durran authored
242 * \#1606 Mongoid now enables autosave, like Active Record, when adding
243 an accepts_nested_attributes_for to a relation.
244
245 class Band
246 include Mongoid::Document
247 has_many :albums
248 accepts_nested_attributes_for :albums # This enables the autosave.
249 end
250
16c3748 @durran Auto protect id and type from mass assignment. Closes #1477.
durran authored
251 * \#1477 Mongoid now automatically protects the id and type attributes
252 from mass assignment. You can override this (not recommended) by redefining
253 them as accessible.
254
255 class Band
256 include Mongoid::Document
257 attr_accessible :id, :_id, :_type
258 end
259
6b75dde @durran Allow safety methods on relation proxies. Closes #1355.
durran authored
260 * \#1459 The identity map can be disabled now for specific code execution
261 by passing options to the unit of work.
262
263 Mongoid.unit_of_work(disable: :all) do
264 # Disables the identity map on all threads for the block.
265 end
266
267 Mongoid.unit_of_work(disable: :current) do
268 # Disables the identity map on the current thread for the block.
269 end
270
271 Mongoid.unit_of_work do
272 # Business as usual.
273 end
274
275 * \#1355 Associations now can have safety options provided to them on single
276 document persistence operations.
277
278 band.albums.safely.push(album)
279 band.albums.safely.create(name: "Smiths")
280
281 album.safely.create_producer(name: "Flood")
282
d4caf38 @durran Eager loading now supported on many to many relations. Closes #1348
durran authored
283 * \#1348 Eager loading is now supported on many-to-many relations.
284
95a95f1 @durran Document#remove_attribute now unsets the attribute instead of set to …
durran authored
285 * \#1292 Remove attribute now unsets the attribute when the document is
286 saved instead of setting to nil.
287
288 band = Band.find(id)
289 band.remove_attribute(:label) # Uses $unset when the document is saved.
290
17f3b00 @durran Add ability to pop embedded documents of a relation with persistence.…
durran authored
291 * \#1212 Embedded documents can now be popped off a relation with persistence.
292
293 band.albums.pop # Pop 1 document and persist the removal.
294 band.albums.pop(3) # Pop 3 documents and persist the removal.
295
f64a63c @durran Add existence predicates for relations. (Andy Morris). Part 1 of #1188.
durran authored
296 * \#1188 Relations now have existence predicates for simplified checking if the
297 relation is blank or not. (Andy Morris)
298
299 class Band
300 include Mongoid::Document
301 embeds_many :albums
302 embeds_one :label
303 end
304
305 band = Band.new
306 band.albums?
307 band.has_albums?
308 band.label?
309 band.has_label?
310
b18ed41 @durran Finish off autobuild functionality. (Andy Morris) Closes #1188.
durran authored
311 * \#1188 1-1 relations now have an :autobuild option to indicate if the
312 relation should automatically be build with empty attributes upon access
313 where the relation currently does not exist. Works on embeds_one,
314 embedded_in, has_one, belongs_to. (Andy Morris)
315
316 class Band
317 include Mongoid::Document
318 has_one :label, autobuild: true
319 end
320
321 band = Band.new
322 band.label # Returns a new label with empty attributes.
323
324 When using existence checks, autobuilding will not execute.
325
326 band = Band.new
327 band.label? # Returns false, does not autobuild on a check.
328 band.has_label? # Returns false, does not autobuild on a check.
329
5deb1d5 @durran Index both id and type on polymorphic belongs_to. Closes #1081.
durran authored
330 * \#1081 Mongoid indexes both id and type as a compound index when providing
331 `index: true` to a polymorphic belongs_to.
332
b238df0 @durran Updating changelog with more descriptive entries for 3.0 features
durran authored
333 class Comment
334 include Mongoid::Document
335
336 # Indexes commentable_id and commentable_type as a compound index.
337 belongs_to :commentable, polymorphic: true, index: true
338 end
339
9433e08 @durran Added Mongoid::Errors::UnknownAttribute:
durran authored
340 * \#1053 Raise a `Mongoid::Errors::UnknownAttribute` instead of no method
341 when attempting to set a field that is not defined and allow dynamic
342 fields is false. (Cyril Mougel)
343
b238df0 @durran Updating changelog with more descriptive entries for 3.0 features
durran authored
344 Mongoid.allow_dynamic_fields = false
345
346 class Person
347 include Mongoid::Document
348 field :title, type: String
349 end
350
351 Person.new.age = 50 # raises the UnknownAttribute error.
352
19303dd @durran Add ability to flag attributes as readonly. Closes #772.
durran authored
353 * \#772 Fields can now be flagged as readonly, which will only let their
354 values be set when the document is new.
355
356 class Band
357 include Mongoid::Document
358 field :name, type: String
359 field :genre, type: String
360
361 attr_readonly :name, :genre
362 end
363
364 Readonly values are ignored when attempting to set them on persisted
365 documents, with the exception of update_attribute and remove_attribute,
366 where errors will get raised.
367
368 band = Band.create(name: "Depeche Mode")
369 band.update_attribute(:name, "Smiths") # Raises ReadonlyAttribute error.
370 band.remove_attribute(:name) # Raises ReadonlyAttribute error.
371
372
8578dd7 @durran Complete rewrite of Mongoid scoping:
durran authored
373 ### Major Changes (Backwards Incompatible)
4cdc72c @durran Remove custom primary keys, identity class:
durran authored
374
375 * `Model.defaults` no longer exists. You may get all defaults with a
376 combination of `Model.pre_processed_defaults` and
8578dd7 @durran Complete rewrite of Mongoid scoping:
durran authored
377 `Model.post_processed_defaults`.
4cdc72c @durran Remove custom primary keys, identity class:
durran authored
378
0bdfaec @durran Update changelog
durran authored
379 Band.pre_processed_defaults
380 Band.post_processed_defaults
381
3afe00a @durran Fix custom typo
durran authored
382 * `Model.identity` and `Model.key` have been removed. For custom ids,
aa61aec @durran Update changelog for new field overriding
durran authored
383 users must now override the _id field.
384
385 When the default value is a proc, the default is applied *after* all
386 other attributes are set.
387
388 class Band
389 include Mongoid::Document
8e1dcb2 @durran Fix typo
durran authored
390 field :_id, type: String, default: ->{ name }
aa61aec @durran Update changelog for new field overriding
durran authored
391 end
392
393 To have the default applied *before* other attributes, set `:pre_processed`
394 to true.
395
396 class Band
397 include Mongoid::Document
398 field :_id,
399 type: String,
400 pre_processed: true,
401 default: ->{ BSON::ObjectId.new.to_s }
402 end
ad1d8d7 @durran Update changelog
durran authored
403
6f7985f @durran Update changelog
durran authored
404 * Custom application exceptions in various languages has been removed,
405 along with the `Mongoid.add_language` feature.
406
855d25e @durran Update changelog to reflect 1.8 drop
durran authored
407 * Mongoid no longer supports 1.8 syntax. 1.9.x or other vms running in
d0a4984 @durran Oops is right.
durran authored
408 1.9 mode is now only supported.
03c934b @durran has_attribute? now behaves the same as AR. Fixes #1484
durran authored
409
1b4be8f @durran Updating changelog
durran authored
410 * \#1734 When searching for documents via `Model.find` with multiple ids,
411 Mongoid will raise an error if not *all* ids are found, and tell you
412 what the missing ones were. Previously the error only got raised if
413 nothing was returned.
414
279c4c3 @durran Adding presence validation to a relation enables autosave for the rel…
durran authored
415 * \#1675 Adding presence validation on a relation now enables autosave.
416 This is to ensure that when a new parent object is saved with a new
417 child and marked is valid, both are persisted to ensure a correct
418 state in the database.
419
03c934b @durran has_attribute? now behaves the same as AR. Fixes #1484
durran authored
420 * \#1484 `Model#has_attribute?` now behaves the same as Active Record.
855d25e @durran Update changelog to reflect 1.8 drop
durran authored
421
9f6617b @durran Don't strip microseconds off time objects. Fixes #1471.
durran authored
422 * \#1471 Mongoid no longer strips any level of precision off of times.
423
a25047a @durran Default use active support time zones to true. Closes #1475.
durran authored
424 * \#1475 Active support's time zone is now used by default in time
425 serialization if it is defined.
426
6957875 @durran Ensure id sorting does not get added if sorting options are already p…
durran authored
427 * \#1342 `Model.find` and `model.relation.find` now only take a single or
428 multiple ids. The first/last/all with a conditions hash has been removed.
a969827 @durran Remove finders that take :first/:last/:all with a conditions hash. Cl…
durran authored
429
8b8d472 @durran Remove all old relation macros. Closes #1270.
durran authored
430 * \#1270 Relation macros have been changed to match their AR counterparts:
431 only :has_one, :has_many, :has_and_belongs_to_many, and :belongs_to
432 exist now.
433
40fd464 @durran Remove alias of #new? to #new_record?. Closes #1268
durran authored
434 * \#1268 `Model#new?` has been removed, developers must now always use
435 `Model#new_record?`.
436
be0b072 @durran Bring more consistency to serialization of array and hash. Closes #1093.
durran authored
437 * \#1093 Field serialization strategies have changed on Array, Hash, Integer
438 and Boolean to be more consistent and match AR where appropriate.
439
440 Serialization of arrays calls `Array.wrap(object)`
441 Serialization of hashes calls `Hash[object]` (to_hash on the object)
442 Serialization of integers always returns an int via `to_i`
443 Serialization of booleans defaults to false instead of nil.
444
58b173f @durran Rename size to count on symbol for complex criterion. Fixes #933
durran authored
445 * \#933 `:field.size` has been renamed to `:field.count` in criteria for
446 $size not to conflict with Symbol's size method.
447
8578dd7 @durran Complete rewrite of Mongoid scoping:
durran authored
448 * \#829/\#797 Mongoid scoping code has been completely rewritten, and now
449 matches the Active Record API. With this backwards incompatible change,
450 some methods have been removed or renamed.
451
452 Criteria#as_conditions and Criteria#fuse no longer exist.
453
454 Criteria#merge now only accepts another object that responds to
219dd76 @durran Fix changelog formatting
durran authored
455 `to_criteria`.
8578dd7 @durran Complete rewrite of Mongoid scoping:
durran authored
456
457 Criteria#merge! now merges in another object without creating a new
458 criteria object.
459
460 Band.where(name: "Tool").merge!(criteria)
461
462 Named scopes and default scopes no longer take hashes as parameters.
463 From now on only criteria and procs wrapping criteria will be
464 accepted, and an error will be raised if the arguments are incorrect.
465
466 class Band
467 include Mongoid::Document
468
469 default_scope ->{ where(active: true) }
470 scope :inactive, where(active: false)
471 scope :invalid, where: { valid: false } # This will raise an error.
472 end
473
474 The 'named_scope' macro has been removed, from now on only use 'scope'.
475
476 Model.unscoped now accepts a block which will not allow default scoping
477 to be applied for any calls inside the block.
478
479 Band.unscoped do
480 Band.scoped.where(name: "Ministry")
481 end
482
483 Model.scoped now takes options that will be set directly on the criteria
484 options hash.
485
486 Band.scoped(skip: 10, limit: 20)
487
4cdc72c @durran Remove custom primary keys, identity class:
durran authored
488 ### Resolved Issues
489
bd3c442 @durran Update changelog to reflect #1859 and #1860.
durran authored
490 * \#1859/#1860 `Model#remove_attribute` now properly unsets on embedded
491 documents. (Anton Onyshchenko)
492
02f5d8b @durran Update changelog
durran authored
493 * \#1852 Ensure no infinite recursion on cascading callbacks. (Ara Howard)
494
29143fb @durran Ensure include works with no unloaded target. Fixes #1823.
durran authored
495 * \#1823 `Relation#includes?` now properly works with identity map enabled.
496
36feef2 @durran Don't flag document is changed if hash and array fields have only bee…
durran authored
497 * \#1810 `Model#changed?` no longer returns true when hash and array fields
498 have only been accessed.
499
5c48070 @durran Ensure first and last in memory for relations matches db returns. Fix…
durran authored
500 * \#1718 Ensure consistency of #first/#last in relations - they now always
501 match first/last in the database, but opts for in memory first.
502
0715b14 @MSNexploder Fixing changelog format - again :-P
MSNexploder authored
503 * \#1692/\#1376 `Model#updateattributes` and `Model#update_attributes!` now
20bf295 @durran Update changelog
durran authored
504 accept assignment options. (Hans Hasselberg)
505
0715b14 @MSNexploder Fixing changelog format - again :-P
MSNexploder authored
506 * \#1688/\#1207 Don't require namespacing when providing class name on
20bf295 @durran Update changelog
durran authored
507 relation macros inside the namespace. (Hans Hasselberg)
508
0715b14 @MSNexploder Fixing changelog format - again :-P
MSNexploder authored
509 * \#1665/\#1672 Expand complex criteria in nested criteria selectors, like
29c197d @MSNexploder Small changelog format fix
MSNexploder authored
510 \#matches. (Hans Hasselberg)
3dca21c @durran Update changelog
durran authored
511
6957875 @durran Ensure id sorting does not get added if sorting options are already p…
durran authored
512 * \#1335 Don't add id sorting criteria to first/last is there is already
513 sorting options on the criteria.
514
c85a1ba @durran Fix typo in changelog
durran authored
515 * \#1135 DateTimes now properly get time zones on deserialization.
f8cda91 @durran Deserialization of DateTimes should take time zone into consideration…
durran authored
516
1057a4b @durran Serialize values in array fields to mongo friendly types. Fixes #1031
durran authored
517 * \#1031 Mongoid now serializes values in Array fields to their proper
518 Mongo-friendly values when possible.
519
85d9900 @durran Raise proper error when attempting to version embedded docs. Closes #685
durran authored
520 * \#685 Attempting to use versioning with embedded documents will now
521 raise a proper error alerting the developer this is not allowed.
522
52d4f0c @durran Update changelog
durran authored
523 ## 2.4.8 (branch: 2.4.0-stable)
524
525 ## 2.4.7
fd6962d @durran Fix json serialization of attributes that need conversion. Fixes #1757.
durran authored
526
b9e6e85 @durran Metadata#options returns self. Fixes #1758
durran authored
527 ### Resolved Issues
528
e296295 @durran Ensure reloading of embedded documents retain reference to the parent
durran authored
529 * Ensure reloading of embedded documents retains reference to the parent.
530
0ef259b @durran Update changelog
durran authored
531 * \#1837 Always pass symbol options to the driver.
532
5c21729 @durran Ensure 0 length and size on loaded and unloaded docs takes into accou…
durran authored
533 * \#1836 Ensure relation counts pick up persisted document that have not
534 had the foreign key link persisted.
535
0be2ecf @durran Reindex and removed destroyed embedded document from unscoped. Fixes …
durran authored
536 * \#1820 Destroying embedded documents in an embeds_many should also
537 removed the document from the underlying _uncoped target and reindex
538 the relation.
539
0f14ce3 @durran Dont cascade after_initialize callbacks - they're happening anyways. …
durran authored
540 * \#1814 Don't cascade callbacks on after_initialize.
541
e2f50c4 @durran Filter out invalid options from the MongoDB connection. Fixes #1800
durran authored
542 * \#1800 Invalid options for the Mongo connection are now filtered out.
543
ae8f037 @durran Case equality has been fixed to handle instance checks. Fixes #1785
durran authored
544 * \#1785 Case equality has been fixed to handle instance checks properly.
545
546 ## 2.4.6
547
548 ### Resolved Issues
549
23d9bca @durran Update changelog
durran authored
550 * \#1772 Allow skip and limit to convert strings to integers. (Jean Boussier)
551
8d0f1aa @durran Update changelog
durran authored
552 * \#1767 Model#update_attributes accepts mass assignment options again.
553 (Hans Hasselberg)
554
bb8584a @durran Convert localized fields in any_of criterion. Fixes #1762
durran authored
555 * \#1762 Criteria#any_of now properly handles localized fields.
556
b9e6e85 @durran Metadata#options returns self. Fixes #1758
durran authored
557 * \#1758 Metadata now returns self on options for external library support.
558
fd6962d @durran Fix json serialization of attributes that need conversion. Fixes #1757.
durran authored
559 * \#1757 Ensure serialization converts any attribute types to the type
560 defined by the field.
561
e3b47c9 @durran Ensure serialization passes options through to embedded docs. Fixes #…
durran authored
562 * \#1756 Serializable hash options should pass through to embedded docs.
563
fd6962d @durran Fix json serialization of attributes that need conversion. Fixes #1757.
durran authored
564 ## 2.4.5
2f67bb6 @durran Update chaneglog to reflect 2.4.5 start
durran authored
565
566 ### Resolved Issues
567
6900c17 @durran Mongoid's logger must respond to level. Fixes #1751.
durran authored
568 * \#1751 Mongoid's logger now responds to level for Ruby logging API
569 compatibility.
570
821f23b @durran Update changelog
durran authored
571 * \#1744/#1750 Sorting works now for localized fields in embedded documents
572 using the criteria API. (Hans Hasselberg)
573
76dc9ae @durran Update changelog
durran authored
574 * \#1746 Presence validation now shows which locales were empty for
575 localized fields. (Cyril Mougel)
576
7b367d0 @lyleunderwood Add support for embeds_many when querying Enumerable:
lyleunderwood authored
577 * \#1727 Allow dot notation in embedded criteria to work on both embeds one
578 and embeds many. (Lyle Underwood)
579
24ac074 @durran Don't call changed on children during initialize callbacks. Fixes #1723
durran authored
580 * \#1723 Initialize callbacks should cascade through children without needing
581 to determine if the child is changed.
582
0227f2c @durran Serializable has returns embedded documents pre and post save. Fixes …
durran authored
583 * \#1715 Serializable hashes are now consistent on inclusion of embedded
584 documents per or post save.
585
809a2af @durran Fix === comparison between classes and instances of subclasses. Fixes…
durran authored
586 * \#1713 Fixing === checks when comparing a class with an instance of a
587 subclass.
588
2f67bb6 @durran Update chaneglog to reflect 2.4.5 start
durran authored
589 * \#1495 Callbacks no longer get the 'super called outside of method` errors on
590 busted 1.8.7 rubies.
591
592 ## 2.4.4
6bb9203 @durran Update changelog
durran authored
593
594 ### Resolved Issues
595
46bee94 @durran Allow reordering of many to many foreign keys. Fixes #1705.
durran authored
596 * \#1705 Allow changing the order of many to many foreign keys.
597
3c69460 @lucasas Versioning updated_at attribute:
lucasas authored
598 * \#1703 Updated at is now versioned again. (Lucas Souza)
599
ebd3b43 @durran Binding belongs to sets metadata on bind and unbind. Fixes #1686
durran authored
600 * \#1686 Set the base metadata on unbind as well as bind for belongs to
601 relations.
602
10660a2 @durran Allow non namespaced models in subdirs to get indexed via rake task. …
durran authored
603 * \#1681 Attempt to create indexes for models without namespacing if the
604 namespace does not exist for the subdirectory.
605
3a1e88a @durran Allow eager loading to work as a default scope. Fixes #1676.
durran authored
606 * \#1676 Allow eager loading to work as a default scope.
607
0715b14 @MSNexploder Fixing changelog format - again :-P
MSNexploder authored
608 * \#1665/\#1672 Expand complex criteria in nested criteria selectors, like
609 \#matches. (Hans Hasselberg)
8bf1c36 @durran Update changelog
durran authored
610
fda12e0 @durran Update changelog
durran authored
611 * \#1668 Ensure Mongoid logger exists before calling warn. (Rémy Coutable)
612
ad94bd4 @durran Ensure uniqueness validation works for clones. Fixes # 1661
durran authored
613 * \#1661 Ensure uniqueness validation works on cloned documents.
614
6fbce3b @durran Clear delayed atomic sets before substitution. Fixes #1659
durran authored
615 * \#1659 Clear delayed atomic sets when resetting the same embedded relation.
616
0715b14 @MSNexploder Fixing changelog format - again :-P
MSNexploder authored
617 * \#1656/\#1657 Don't hit database for uniqueness validation if BOTH scope
6bb9203 @durran Update changelog
durran authored
618 and attribute hasn't changed. (priyaaank)
619
0715b14 @MSNexploder Fixing changelog format - again :-P
MSNexploder authored
620 * \#1205/\#1642 When limiting fields returned from the database via
191486e @durran Don't overwrite persisted fields after only/without limitation:
durran authored
621 `Criteria#only` and `Criteria#without` and then subsequently saving
622 the document. Default values no longer override excluded fields.
623
bb801e0 @durran Update changelog
durran authored
624 ## 2.4.3
6ed6917 @durran Update changelog to reflect dev branch changes
durran authored
625
c0dbbc7 @durran Updating changelog
durran authored
626 ### Resolved Issues
627
a8fb507 @durran Fix DateTime serialization when using UTC:
durran authored
628 * \#1647 DateTime serialization when already in UTC does not convert to
629 local time.
630
0715b14 @MSNexploder Fixing changelog format - again :-P
MSNexploder authored
631 * \#1641/\#1639 Mongoid.observer.disable :all now behaves as AR does.
76dc254 @durran Update changelog
durran authored
632
77553f1 @durran Set update consumers to the collection name, not the class. Fixes #1640
durran authored
633 * \#1640 Update consumers should be tied to the name of the collection
634 they persist to, not the name of the class.
635
0715b14 @MSNexploder Fixing changelog format - again :-P
MSNexploder authored
636 * \#1637/\#1636 Scopes no longer modify parent class scopes when subclassing.
0283bf7 @durran Update changelog
durran authored
637 (Hans Hasselberg)
638
01ba90d @durran Update changelog
durran authored
639 * \#1629 $all and $in criteria on embedded many relations now properly
640 handles regex searches and elements of varying length. (Douwe Maan)
641
0715b14 @MSNexploder Fixing changelog format - again :-P
MSNexploder authored
642 * \#1623/\#1634 Default scopes no longer break Mongoid::Versioning.
5404ac5 @durran Add Hans name to #1623 fix.
durran authored
643 (Hans Hasselberg)
6ed6917 @durran Update changelog to reflect dev branch changes
durran authored
644
5428244 @cgriego Fix rescue_responses in Rails 3.2, broken by #1605
cgriego authored
645 * \#1605 Fix regression of rescue responses, Rails 3.2
646
6ed6917 @durran Update changelog to reflect dev branch changes
durran authored
647 ## 2.4.2
09de360 @durran Serialize boolean values in criteria when nested inside a defined arr…
durran authored
648
c9ea7ae @durran Raise DocumentNotFound instead of NoMethodErros:
durran authored
649 ### Resolved Issues
650
d3f70fd @durran Update changelog and reformat spec
durran authored
651 * \#1628 _type field can once again be included in serialization to json
652 or xml as a global option with `include_type_for_serialization`.
653 (Roman Shterenzon)
654
9401a74 @durran Updating changelog to reflect #1627
durran authored
655 * \#1627 Validating format now works properly with localized fields.
656 (Douwe Maan)
657
dd9ba25 @durran Add relation proxy methods to prohibited fields. Fixes #1617
durran authored
658 * \#1617 Relation proxy methods now show up in Mongoid's list of
659 prohibited fields.
660
fb22b15 @durran Allow 1 main location for mongoid spec run host and port connection i…
durran authored
661 * \#1615 Allow a single configuration of host and port for all spec runs,
662 overridden by setting MONGOID_SPEC_HOST and MONGOID_SPEC_PORT env vars.
663
686098c @durran Hard delete paranoid versioned documents:
durran authored
664 * \#1610 When versioning paranoid documents and max version is set, hard
665 delete old versions from the embedded relation.
666
d9354d6 @durran Allow connection retries on cursor iteration. Closes #1609.
durran authored
667 * \#1609 Allow connection retry during cursor iteration as well as all other
668 operations.
669
c9ea7ae @durran Raise DocumentNotFound instead of NoMethodErros:
durran authored
670 * \#1608 Guard against no method errors when passing ids in nested attributes
671 and the documents do not exist.
672
800ce67 @durran Remove deprecation warning in rescue responses for rails 3.2. Fixes #…
durran authored
673 * \#1605 Remove deprecation warning on rescue responses, Rails 3.2
674
cb36a1b @durran Update changelog
durran authored
675 * \#1602 Preserve structure of $and and $or queries when typecasting.
676
9efe3b4 @durran Array fields can be reordered with the same elements. Fixes #1597
durran authored
677 * \#1600 Uniqueness validation no longer errors when provided a relation.
678
115e289 @durran Enumerable targets should always yield to in memory docs first. Fixes…
durran authored
679 * \#1599 Make sure enumerable targets yield to what is in memory first when
680 performing #each, not always the unloaded first.
681
9efe3b4 @durran Array fields can be reordered with the same elements. Fixes #1597
durran authored
682 * \#1597 Fix the ability to change the order of array fields with the same
683 elements.
684
09de360 @durran Serialize boolean values in criteria when nested inside a defined arr…
durran authored
685 * \#1590 Allow proper serialization of boolean values in criteria where the
686 field is nested inside an array.
687
688 ## 2.4.1
ca99200 @durran Merge in changelog
durran authored
689
690 ### Resolved Issues
691
72fb250 @durran Allow embedded arrays to properly get updated atomically. Fixes #1593
durran authored
692 * \#1593 Arrays on embedded documents now properly atomically update when
693 modified from original version.
694
41e8ed4 @durran Don't swallow mongo exceptions in the create_indexes rake task. Fixes…
durran authored
695 * \#1592 Don't swallow exceptions from index generation in the create_indexes
696 rake task.
697
df828ba @durran Allow assignment of empty array to HABTM when no docs are loaded from…
durran authored
698 * \#1589 Allow assignment of empty array to HABTM when no documents are yet
699 loaded into memory.
700
714d92b @durran Allow atomic set from explicit nil on array to new values. Fixes #1587
durran authored
701 * \#1587 When a previous value for an array field was an explicit nil, it can
702 now be reset atomically with new values.
703
1784470 @durran Documents should respond to the setter of a dynamic attribute. Fixes …
durran authored
704 * \#1585 `Model#respond_to?` returns true now for the setter when allowing
705 dynamic fields.
706
80ceba2 @durran Allow nil values to get set into arrays. Fixes #1582.
durran authored
707 * \#1582 Allow nil values to be set in arrays.
708
629b215 @durran Allow existing array fields to be set to nil and not just emptied. Fi…
durran authored
709 * \#1580 Allow arrays to be set to nil post save, and not just empty.
710
55d2cf4 @durran Don't call #to_a on individual set field elements in criterion. Fixes…
durran authored
711 * \#1579 Don't call #to_a on individual set field elements in criterion.
712
44a3b04 @durran Don't hit database on uniqueness validation if the field has not chan…
durran authored
713 * \#1576 Don't hit database on uniqueness validation if the field getting
714 validated has not changed.
715
0a7d9a4 @durran Update changelog for #1578. Fixes #1571
durran authored
716 * \#1571 Aliased fields get all the dirty attribute methods and all getters and
717 setters for both the original name and the alias. (Hans Hasselberg)
718
ca99200 @durran Merge in changelog
durran authored
719 * \#1568 Fallback to development environment with warning when no env configured.
720
7d0e23e @durran Use class_eval or define_method where appropriate:
durran authored
721 * \#1565 For fields and foreign keys with non-standard Ruby or database names,
722 use define_method instead of class_eval for creating the accessors and
723 dirty methods.
724
502febe @durran Remove internal strategy class due to conflicts. Fixes #1557
durran authored
725 * \#1557 Internal strategy class no longer conflicts with models.
726
e137519 @durran Document#changed? returns true now if only children change:
durran authored
727 * \#1551 Parent documents now return `true` for `Model#changed?` if only child
728 (embedded) documents have changed.
729
38106e0 @durran Move changes on persisted children when parent was new post-callbacks…
durran authored
730 * \#1547 Resetting persisted children from a parent save when new waits until post
731 callbacks, mirroring update functionality.
732
933d385 @durran Fix issue number
durran authored
733 * \#1536 Eager loading now happens when calling `first` or `last` on a
4b551ba @durran Criteria#first and #last can now eager load:
durran authored
734 criteria if inclusions are specified.
735
4cdc72c @durran Remove custom primary keys, identity class:
durran authored
736 ## 2.4.0
b6a2a99 Add range queries to Criteria#where
Durran Jordan and Hans Hasselberg authored
737
055e6ef @durran Merge in 2.3.0-stable
durran authored
738 ### New Features
739
b6a2a99 Add range queries to Criteria#where
Durran Jordan and Hans Hasselberg authored
740 * Ranges can now be passed to #where criteria to create a $gte/$lte query under the
741 covers. `Person.where(dob: start_date...end_date)`
742
7da4c78 @durran Update changelog
durran authored
743 * Custom serializable fields can now override #selection to provide
744 customized serialization for criteria queries.
745
a4d5a66 @durran User Array.wrap instead of to_a where possible. Fixes #1544.
durran authored
746 * \#1544 Internals use `Array.wrap` instead of `to_a` now where possible.
747
8e57848 @durran Fixing pull #1511 to actually pass the expected values to the validat…
durran authored
748 * \#1511 Presence validation now supports localized fields. (Tiago Rafael Godinho)
749
5a214bf @durran Allow nil values with $set via Model#set
durran authored
750 * \#1506 `Model.set` will now accept false and nil values. (Marten Veldthuis)
751
69208fe @durran delete_all/destroy_all now accept 2 kinds of params:
durran authored
752 * \#1505 `Model.delete_all/destroy_all` now take either a :conditions hash or
753 the attributes directly.
754
4fd31aa @durran Merging in pull #1504 with updated changelog
durran authored
755 * \#1504 `Model.recursively_embeds_many` now accepts a :cascade_callbacks
756 option. (Pavel Pravosud)
757
1444608 @durran Convert strings back to symbols on deserialization. Fixes #1496.
durran authored
758 * \#1496 Mongoid now casts strings back to symbols for symbol fields that
759 get saved as strings by another application.
760
7d26541 @durran Move after_build callback to post yield.
durran authored
761 * \#1454, \#900 Associations now have an `after_build` callback that gets
762 executed after `.build` or `build_` methods are called.
763 (Jeffrey Jones, Ryan Townsend)
764
6524aeb @durran Update changelog
durran authored
765 * \#1451 Ranges can now be any range value, not just numbers. (aupajo)
766
767 * \#1448 Localization is now used when sorting. (Hans Hasselberg)
768
d62fdb7 @durran Merge in pull request #1422
durran authored
769 * \#1422 Mongoid raises an error at yaml load if no environment is found.
770 (Tom Stuart)
771
4087c0e @durran Update changelog for pull requests
durran authored
772 * \#1413 $not support added to criteria symbol methods. (Marc Weil)
773
b496b8d @durran Merging in #1403 and providing english translations in the other loca…
durran authored
774 * \#1403 Added configuration option `scope_overwrite_exception` which defaults to
775 false for raising an error when defining a named scope with the same name of
776 an existing method. (Christoph Grabo)
777
4cb8278 @durran Allow Model#add_to_set to accept multiple values. (Christian Felder).…
durran authored
778 * \#1388 `model.add_to_set` now supports adding multiple values and performs an
779 $addToSet with $each under the covers. (Christian Felder)
780
c40a43f @durran Refactor common code in threaded module
durran authored
781 * \#1387 Added `Model#cache_key` for use in Rails caching. (Seivan Heidari)
94759ff @durran Merge in #1387, move functionality into document from timestamps.
durran authored
782
1011f8d @durran Convert params to Model.find(id) to whatever the _id field type is de…
durran authored
783 * \#1380 Calling Model.find(id) will now properly convert to and from any type
784 based on the type of the _id field.
785
ae473a8 @durran Add default support to localized fields. Closes #1363.
durran authored
786 * \#1363 Added fallbacks and default support to localized fields, and added
787 ability to get and set all translations at once.
788
241127b @durran Aliased fields typecast in criteria. Closes #1362.
durran authored
789 * \#1362 Aliased fields now properly typecast in criteria.
790
b7265bb @durran No longer perform simple $set operations on dirty arrays:
durran authored
791 * \#1337 Array fields, including HABTM many foreign keys now have smarter dirty
792 checking and no longer perform a simple $set if the array has changed. If
793 items have only been added to the array, it performs a $pushAll. If items
794 have only been removed, it performs a $pullAll. If both additions and
795 removals have occurred it performs a $set to avoid conflicting mods.
796
c40a43f @durran Refactor common code in threaded module
durran authored
797 ### Resolved Issues
40a46ef @durran Calling destroy on any document now temporarily marks it as
durran authored
798
d6248c3 @durran Fixing document freezing on Rubinius:
durran authored
799 * Calling `Document#as_document` on a frozen document on Rubinius returns the
800 attributes instead of nil.
801
888d153 @durran Split setting of defaults into proc/non-proc calls at different times…
durran authored
802 * \#1554 Split application of default values into proc/non-procs, where
803 non-procs get executed immediately during instantiation, and procs get
804 executed after all other values are set.
805
925c0e2 @durran Fix removal/addition of array fields dirty tracking. Fixes #1553.
durran authored
806 * \#1553 Combinations of adding and removing values from an array use a $set
807 on the current contents of the array, not the new values.
808
e1946b3 @durran Document#changes returns a hash with indifferent access. Fixes #1546.
durran authored
809 * \#1546 Dirty changes should be returned in a hash with indifferent access.
810
afc06f8 @durran Ensure eager loading takes options into account. Fixes #1542.
durran authored
811 * \#1542 Eager loading now respects the options (ie skip, limit) provided to
812 the criteria when fetch the associations.
813
9e561d0 @durran Array foreign key fields perform $addToSet ops via dirty tracking. Fi…
durran authored
814 * \#1530 Don't duplicate added values to arrays via dirty tracking if the
815 array is a foreign key field.
816
9bea0e6 @durran Calling unscoped on relational associations now works properly. Fixes…
durran authored
817 * \#1529 Calling `unscoped` on relational associations now works properly.
818
f9e89dc @durran Allow access to relations in overridden field setters. Fixes #1524.
durran authored
819 * \#1524 Allow access to relations in overridden field setters by pre-setting
820 foreign key default values.
821
8b90216 @durran Update changelog
durran authored
822 * \#1523 Allow disabling of observers via `disable`. (Jonas Schneider)
823
2693a5c @durran Update changelog
durran authored
824 * \#1522 Fixed create indexes rake task for Rails 3.2. (Gray Manley)
825
feb0a15 @durran Update changelog
durran authored
826 * \#1517 Fix Mongoid documents to properly work with RSpec's stub_model.
827 (Tiago Rafael Godinho)
828
444c9c4 @durran Don't persist on relational bindings under any circumstance.
durran authored
829 * \#1516 Don't duplicate relational many documents on bind.
830
7da4c78 @durran Update changelog
durran authored
831 * \#1515 Mongoid no longer attempts to serialize custom fields on complex
832 criteria by default.
833
d1d410b @durran Handle any mixture of old and new docs when replacing a has_many. Fix…
durran authored
834 * \#1503 Has many relation substitution now handles any kind of mix of existing
835 and new docs.
836
0978922 @durran Fix changelog formatting
durran authored
837 * \#1502 Nested attributes on embedded documents respects if the child is
866b5c7 @durran Nested attributes now respects deleting child paranoid embedded docum…
durran authored
838 paranoid.
839
478c783 @durran Fix failing spec from #1497, update changelog.
durran authored
840 * \#1497 Use provided message on failing uniqueness validation. (Justin Etheredge)
841
f15c50e @durran Update changelog
durran authored
842 * \#1491 Return nil when no default set on localized fields. (Tiago Rafael Godinho)
843
c32da79 @durran Add fields to subclasses when getting added to the parent. Fixes #1483.
durran authored
844 * \#1483 Sending module includes at runtime which add new fields to a parent
845 document, also have the fields added to subclasses.
846
e0c5487 @durran Rearragning specs and updating changelog post 1482.
durran authored
847 * \#1482 Applying new sorting options does not merge into previously
848 chained criteria. (Gerad Suyderhoud)
849
bd73d95 @durran Don't duplicate ids on many-to-many create and create!. Fixes #1479.
durran authored
850 * \#1481 Fix invalid query when accessing many-to-many relations before
851 defaults are set.
852
bcda02a @durran Repackaging the serializable fields to internal to avoid conflicts wi…
durran authored
853 * \#1480 Mongoid's internal serialized field types renamespaced to Internal in order
854 to not conflict with ruby core classes in custom serializable types.
855
bd73d95 @durran Don't duplicate ids on many-to-many create and create!. Fixes #1479.
durran authored
856 * \#1479 Don't duplicate ids on many-to-many when using create or create!
857
f2dada1 @durran Use criteria selector to pull from identity map if extract_id is nil.…
durran authored
858 * \#1469 When extract_id returns nil, get the document out of the identity map
859 by the criteria selector.
860
5ba88f5 @durran Ensure defining a field named metadata raises an error. Closes #1467.
durran authored
861 * \#1467 Defining a field named metadata now properly raises an invalid field
862 error.
863
693f3c9 @durran Batch insert consumers should scope to the collection. Fixes #1463.
durran authored
864 * \#1463 Batch insert consumers are now scoped to collection to avoid persistence
865 of documents to other collections in callbacks going to the wrong place.
866
2bbb85f @durran Don't autosave relation on nested attributes setter assignment. Fixes…
durran authored
867 * \#1462 Assigning has many relations via nested attribtues `*_attributes=` does
868 not autosave the relation.
869
98d989a @durran Don't escape entire hash of foreign key criteria arguments. Fixes #1461.
durran authored
870 * \#1461 Fixed serialization of foreign key fields in complex criteria not to
871 escape the entire hash.
872
5e1aa45 @durran Don't skip fields protected from mass assignment when versioning. Fix…
durran authored
873 * \#1458 Versioning no longer skips fields that have been protected from mass
874 assignment.
875
40a46ef @durran Calling destroy on any document now temporarily marks it as
durran authored
876 * \#1455, \#1456 Calling destroy on any document now temporarily marks it as
877 flagged for destroy until the operation is complete. (Nader Akhnoukh)
055e6ef @durran Merge in 2.3.0-stable
durran authored
878
a6821d2 @durran Fix typo in changelog
durran authored
879 * \#1453 `Model#to_key` should return a value when the document is destroyed.
9381dc9 @durran Destroyed documents should return id in Model.to_key. Fixes #1453
durran authored
880
bd4df6f @durran Provide fix for specs in #1449.
durran authored
881 * \#1449 New documents no longer get persisted when replaced on a has one as
882 a side effect. (jasonsydes)
883
c52d330 @durran embedded? should return true when relation is defined as cyclic. Clos…
durran authored
884 * \#1439 embedded? should return true when relation defined as cyclic.
885
7a91539 @durran Use the existing class to convert string to bson ids with nested attr…
durran authored
886 * \#1433 Polymorphic nested attributes for embedded and relational 1-1 now
887 update properly.
888
9526660 @durran Update changelog
durran authored
889 * \#1426 Frozen documents can now be cloned. (aagrawal2001)
890
4087c0e @durran Update changelog for pull requests
durran authored
891 * \#1382 Raise proper error when creating indexes via rake task if index
892 definition is incorrect. (Mathieu Ravaux)
893
81159b8 @durran Merging in pull request #1381.
durran authored
894 * \#1381, \#1371 The identity map now functions properly with inherited
895 documents. (Paul Canavese)
896
e4fa8b1 @durran Move embedded many concats out into it's own method.
durran authored
897 * \#1370 Split concat on embedded arrays into its own method to handle the
898 batch processing due to after callback run execution issues.
899
4aa0df3 @durran Deep copy array and hash values for accurate dirty traking when nesti…
durran authored
900 * \#1366 Array and hash values now get deep copied for dirty tracking.
901
a6e559e @durran Provide ability to avoid all named scopes to be applied with default …
durran authored
902 * \#1359 Provide ability to not have default scope applied to all named
903 scopes via using lambdas.
904
b9e7a33 @durran Fix specs, update changelog
durran authored
905 * \#1333 Fixed errors with custom types that exist in namespaces. (Peter Gumeson)
906
ff654ec @durran Treat default values as dirty if they differ from the database state.…
durran authored
907 * \#1259 Default values are treated as dirty if they differ from the database
908 state.
909
05aab6e @durran Update rdoc and changelog post #1255.
durran authored
910 * \#1255 Ensure embedded documents respect the defined default scope.
911
3017c2a @durran Update changelog
durran authored
912 ## 2.3.4
948801c @durran Update changelog
durran authored
913
4f62b9e @durran Remove duplicates from the loaded array on each as the second conditi…
durran authored
914 * \#1445 Prevent duplicate documents in the loaded array on the target
915 enumerable for relational associations.
916
73020aa @durran Allow destructive replacement on has_one relations when using create_…
durran authored
917 * \#1442 When using create_ methods for has one relations, the appropriate
918 destructive methods now get called when replacing an existing document.
919
e3f9e8d @durran Change enumerable context to add to loaded array post yield, instead …
durran authored
920 * \#1431 Enumerable context should add to the loaded array post yield, so
921 that methods like #any? that short circuit based on the value of the block
922 dont falsely have extra documents.
923
947bdbc @durran Don't load previous revisions of documents into the identity map. Fix…
durran authored
924 * \#1418 Documents being loaded from the database for revision purposes
925 no longer get placed in the identity map.
926
fe1472c @durran Allow casting of foreign keys where appropriate in serialization to n…
durran authored
927 * \#1399 Allow conversion of strings to integers in foreign keys where the
928 id is defined as an int.
929
ddcd16e @durran Don't add default sorting criteria on first if they sort criteria alr…
durran authored
930 * \#1397 Don't add default sorting criteria on first if they sort criteria
931 already exists.
932
fc2dbf4 @durran Update changelog to reflect nicks fix
durran authored
933 * \#1394 Fix exists? to work when count is greater than 1. (Nick Hoffman)
934
33b1fff @durran Return zero on aggregations when field does not exist. Fixes #1392
durran authored
935 * \#1392 Return 0 on aggregation functions where field is nonexistant.
936
28ab6d8 @durran Fix uniqueness validation with embedded documents using primary keys …
durran authored
937 * \#1391 Uniqueness validation now works properly on embedded documents that are
938 using primary key definitions.
939
33507e5 @durran When _type field is altered attempt to correctly instantiate the clas…
durran authored
940 * \#1390 When _type field is lower case class camelize before constantizing.
941
4b93f99 @durran Fix cast on read for serializable fields that are subclassed. Fixes #…
durran authored
942 * \#1383 Fix cast on read for serializable fields that are subclassed.
943
04c3870 @durran Fix delayed atomic sets and push interactions for documents embedded …
durran authored
944 * \#1357 Delayed atomic sets from update_attributes on embedded documents
945 multiple levels deep now properly persist.
946
19a4583 @durran Synchronize base keys on save of newly built inverse documents on HAB…
durran authored
947 * \#1326 Ensure base document on HABTM gets its keys saved after saving a newly
948 build child document.
949
0e43b30 @durran Don't override base document metadata on embedded in relations if alr…
durran authored
950 * \#1301 Don't overwrite base metadata on embedded in relations if already set.
951
4e0759e @durran Update changelog
durran authored
952 * \#1221 HABTM with inverse nil is allowed again on embedded documents.
953
8c4375e @durran Don't auto-persist embedded in relations on initialization. Fixes #1208.
durran authored
954 * \#1208 Don't auto-persist child documents via the setter when setting from
955 an embedded_in.
956
2089085 @durran Root document timestamps get updated when only embedded documents hav…
durran authored
957 * \#791 Root document updates its timestamps when only embedded documents have
958 changed.
959
948801c @durran Update changelog
durran authored
960 ## 2.3.3
ae96e29 @durran Fix type errors on many-to-many relations with a nil inverse. Fixes #…
durran authored
961
962 ### Resolved Issues
963
6b412f0 @durran Update changelog
durran authored
964 * \#1386 Lowered mongo/bson dependency to 1.3
965
bead126 @durran Fix aggregate functions to handle non existant fields. Fixes #1377. (…
durran authored
966 * \#1377 Fix aggregation functions to properly handle nil or indefined values.
967 (Maxime Garcia)
968
cc9d285 @durran Update changelog
durran authored
969 * \#1373 Warn if a scope overrides another scope.
970
184376b @durran Don't persist in a create block when reading for validation. Fixes #1…
durran authored
971 * \#1372 Never persist when binding inside of a read attribute for validation.
972
01122fe @durran Fix reloading of documents with non-object ids as their ids. Fixes #1…
durran authored
973 * \#1364 Fixed reloading of documents with non bson object id ids.
974
77f3ecf @durran Fix performanace of dev load times with observers in rails. Fixes #1360.
durran authored
975 * \#1360 Fixed performance of Mongoid's observer instantiation by hooking into
976 Active Support's load hooks, a la AR.
977
ae96e29 @durran Fix type errors on many-to-many relations with a nil inverse. Fixes #…
durran authored
978 * \#1358 Fixed type error on many to many synchronization when inverse_of is
979 set to nil.
980
3cdd5f5 @durran Update changelog
durran authored
981 * \#1356 $in criteria can now be chained to non-complex criteria on the same
982 key without error.
983
7d152bc @durran Update changelog
durran authored
984 * \#1350, \#1351 Fixed errors in the string conversions of double quotes and
985 tilde when paramterizing keys.
986
999e9d0 @durran Documents should not blow up when including enumerable. Fixes #1349
durran authored
987 * \#1349 Mongoid documents should not blow up when including Enumerable.
988 (Jonas Nicklas)
989
ae96e29 @durran Fix type errors on many-to-many relations with a nil inverse. Fixes #…
durran authored
990 ## 2.3.2
16d6f2f @durran Document#reload on an embedded document now works properly. Fixes #736.
durran authored
991
9b06181 @durran Merging in 2.3.0-stable
durran authored
992 ### Resolved Issues
993
eb90725 @durran Return default matcher for hash values that dont have modifier keys. …
durran authored
994 * \#1347 Fix embedded matchers when provided a hash value that does not have a
995 modifier as a key.
996
13e7e55 @durran Update changelog
durran authored
997 * \#1346 Dup default sorting criteria when calling first/last on a criteria.
998
16d6f2f @durran Document#reload on an embedded document now works properly. Fixes #736.
durran authored
999 * \#1343 When passing no arguments to `Criteria#all_of` return all documents.
1000 (Chris Leishman)
1001
518ea6b Update that changelog, like a boss.
Dave Krupinski and Durran Jordan authored
1002 * \#1339 Ensure destroy callbacks are run on cascadable children when deleting via
1003 nested attributes.
1004
a47a904 @durran Respect inverse_of: nil on self referencing many-to-many relations. F…
durran authored
1005 * \#1324 Setting `inverse_of: nil` on a many-to-many referencing the same class
1006 returns nil for the inverse foreign key.
1007
23d758e @durran Updating changelog
durran authored
1008 * \#1323 Allow both strings and symbols as ids in the attributes array for
1009 nested attributes. (Michael Wood)
1010
0465832 @durran Update changelog
durran authored
1011 * \#1312 Setting a logger on the config now accepts anything that quacks like a
1012 logger.
1013
14e5bdc @durran Update changelog
durran authored
1014 * \#1297 Don't hit the database when accessing relations if the base is new.
1015
1ec8bbc @durran Update changelog
durran authored
1016 * \#1239 Allow appending of referenced relations in create blocks, post default set.
1017
23d758e @durran Updating changelog
durran authored
1018 * \#1236 Ensure all models are loaded in rake tasks, so even in threadsafe mode
1019 all indexes can be created.
1020
16d6f2f @durran Document#reload on an embedded document now works properly. Fixes #736.
durran authored
1021 * \#736 Calling #reload on embedded documents now works properly.
1022
ab74efb Update master changelog
Dave Krupinski and Durran Jordan authored
1023 ## 2.3.1
e34f140 @durran Merge changelog
durran authored
1024
49aef9e @durran Sync CHNAGELOG across active branches
durran authored
1025 ### Resolved Issues
1026
fd6a135 Updating changelog
Dave Krupinski and Durran Jordan authored
1027 * \#1338 Calling #find on a scope or relation checks that the document in the
1028 identity map actually matches other scope parameters.
1029
49aef9e @durran Sync CHNAGELOG across active branches
durran authored
1030 * \#1321 HABTM no longer allows duplicate entries or keys, instead of the previous
1031 inconsistencies.
1032
1033 * \#1320 Fixed errors in perf benchmark.
1034
1035 * \#1316 Added a separate Rake task "db:mongoid:drop" so Mongoid and AR can coexist.
1036 (Daniel Vartanov)
1037
1038 * \#1311 Fix issue with custom field serialization inheriting from hash.
1039
fd6a135 Updating changelog
Dave Krupinski and Durran Jordan authored
1040 * \#1310 The referenced many enumerable target no longer duplicates loaded and
1041 added documents when the identity map is enabled.
1042
87a1d4a @durran Fix eager loading to load all relations passed to includes. Fixes #1295.
durran authored
1043 * \#1295 Fixed having multiple includes only execute the eager loading of the first.
1044
49aef9e @durran Sync CHNAGELOG across active branches
durran authored
1045 * \#1287 Fixed max versions limitation with versioning.
1046
1047 * \#1277 attribute_will_change! properly flags the attribute even if no change occured.
1048
fd6a135 Updating changelog
Dave Krupinski and Durran Jordan authored
1049 * \#1063 Paranoid documents properly run destroy callbacks on soft destroy.
1050
bf01898 @durran Update changelog
durran authored
1051 * \#1061 Raise `Mongoid::Errors::InvalidTime` when time serialization fails.
1052
311bbe4 @durran Update changelog to include 1002
durran authored
1053 * \#1002 Check for legal bson ids when attempting conversion.
1054
49aef9e @durran Sync CHNAGELOG across active branches
durran authored
1055 * \#920 Allow relations to be named target.
1056
399f46f @durran Return normalized class name for relation definitions that prepend ::…
durran authored
1057 * \#905 Return normalized class name in metadata if string was defined with a
1058 prefixed ::.
1059
49aef9e @durran Sync CHNAGELOG across active branches
durran authored
1060 * \#861 accepts_nested_attributes_for is no longer needed to set embedded documents
1061 via a hash or array of hashes directly.
1062
731032f @durran Sync CHANGELOG
durran authored
1063 * \#857 Fixed cascading of dependent relations when base document is paranoid.
1064
49aef9e @durran Sync CHNAGELOG across active branches
durran authored
1065 * \#768 Fixed class_attribute definitions module wide.
1066
1067 * \#408 Embedded documents can now be soft deleted via `Mongoid::Paranoia`.
709acc4 @durran updating CHANGELOG
durran authored
1068
be78d8c @durran Updating changelog
durran authored
1069 ## 2.3.0
813392f @durran Updating changelog to current master
durran authored
1070
1071 ### New Features
1072
1073 * Mongoid now supports basic localized fields, storing them under the covers as a
49aef9e @durran Sync CHNAGELOG across active branches
durran authored
1074 hash of locale => value pairs. `field :name, localize: true`
813392f @durran Updating changelog to current master
durran authored
1075
4e1f8a9 @durran Updating changelog for unsafely addition.
durran authored
1076 * \#1275 For applications that default safe mode to true, you can now tell a
1077 single operation to persist without safe mode via #unsafely:
1078 `person.unsafely.save`, `Person.unsafely.create`. (Matt Sanders)
1079
32abed3 @durran Update changelog to include latest fixes
durran authored
1080 * \#1256 Mongoid now can create indexes for models in Rails engines. (Caio Filipini)
1081
8046299 @durran Updating changelog
durran authored
1082 * \#1228 Allow pre formatting of compsoite keys by passing a block to #key.
1083 (Ben Hundley)
1084
3d05a17 @durran Updating changelog to reflect scoped mass assignment
durran authored
1085 * \#1222 Scoped mass assignment is now supported. (Andrew Shaydurov)
1086
32abed3 @durran Update changelog to include latest fixes
durran authored
1087 * \#1196 Timestamps can now be turned off on a call-by-call basis via the use
1088 of #timeless: `person.timeless.save`, `Person.timeless.create(:title => "Sir")`.
1089
86384ae @durran Updating changelog
durran authored
1090 * \#1103 Allow developers to create their own custom complex criteria. (Ryan Ong)
1091
81f81e1 @cgriego Include all defined fields in `serializable_hash`.
cgriego authored
1092 * Mongoid now includes all defined fields in `serializable_hash` and `to_json`
1093 results even if the fields have no values to make serialized documents easier
1094 to use by ActiveResource clients.
1095
49e3c4e @durran Updating changelog to reflect MongoDB version requirement
durran authored
1096 * Support for MongoDB's $and operator is now available in the form of:
1097 `Criteria#all_of(*args)` where args is multiple hash expressions.
1098
be78d8c @durran Updating changelog
durran authored
1099 * \#1250, \#1058 Embedded documents now can have their callbacks fired on a parent
1100 save by setting `:cascade_callbacks => true` on the relation.
1101 (pyromanic, Paul Rosania, Jak Charlton)
1102
813392f @durran Updating changelog to current master
durran authored
1103 ### Major Changes
1104
1105 * Mongoid now depends on Active Model 3.1 and higher.
1106
1107 * Mongoid now depends on the Mongo Ruby Driver 1.4 and higher.
1108
49e3c4e @durran Updating changelog to reflect MongoDB version requirement
durran authored
1109 * Mongoid requires MongoDB 2.0.0 and higher.
1110
813392f @durran Updating changelog to current master
durran authored
1111 ### Resolved Issues
1112
32abed3 @durran Update changelog to include latest fixes
durran authored
1113 * \#1308 Fixed scoping of HABTM finds.
1114
1115 * \#1300 Namespaced models should handle recursive embedding properly.
1116
3745763 @durran Don't fail on binding with self-referenced versioned documents. Fixes…
durran authored
1117 * \#1299 Self referenced documents with versioning no longer fail when inverse_of
1118 is not defined on all relations.
1119
32abed3 @durran Update changelog to include latest fixes
durran authored
1120 * \#1296 Renamed internal building method to _building.
1121
1d0d267 @durran Exclude _id and updated_at from versioned attributes.
durran authored
1122 * \#1288, \#1289 _id and updated_at should not be part of versioned attributes.
1123
813392f @durran Updating changelog to current master
durran authored
1124 * \#1273 Mongoid.preload_models now checks if preload configuration option is set,
1125 where Mongoid.load_models always loads everything. (Ryan McGeary)
1126
32abed3 @durran Update changelog to include latest fixes
durran authored
1127 * \#1244 Has one relations now adhere to default dependant behaviour.
1128
1129 * \#1225 Fixed delayed persistence of embedded documents via $set.
1130
bd96164 @durran Update changelog
durran authored
1131 * \#1166 Don't load config in Railtie if no env variables defined. (Terence Lee)
1132
813392f @durran Updating changelog to current master
durran authored
1133 * \#1052 `alias_attribute` now works again as expected.
1134
8046299 @durran Updating changelog
durran authored
1135 * \#939 Apply default attributes when upcasting via #becomes. (Christos Pappas)
1136
b0760d2 @durran Fix casting of integer fields with leading zeros. Fixes #932.
durran authored
1137 * \#932 Fixed casting of integer fields with leading zeros.
1138
86384ae @durran Updating changelog
durran authored
1139 * \#948 Reset version number on clone if versions existed.
1140
1141 * \#763 Don't merge $in criteria arrays when chaining named scopes.
1142
1143 * \#730 Existing models that have relations added post persistence of originals
1144 can now have new relations added with no migrations.
1145
8388554 @durran Update changelog for recent fixes
durran authored
1146 * \#726 Embedded documents with compound keys not validate uniqueness correctly.
1147
1148 * \#582 Cyclic non embedded relations now validate uniqueness correctly.
1149
1150 * \#484 Validates uniqueness with multiple scopes of all types now work properly.
1151
c63ac24 @durran Ensure cascade callbacks do not fire when deleting versions
durran authored
1152 * Deleting versions created with `Mongoid::Versioning` no longer fires off
1153 dependent cascading on relations.
1154
234db48 @durran Update changelog to reflect 2.2.5 release. Closes #1166.
durran authored
1155 ## 2.2.5
1156
1157 * This was a small patch release to address 2.2.x Heroku errors during asset
1158 compilation.
1159
aea719c @durran Update master changelog
durran authored
1160 ## 2.2.4
1161
1162 * \#1377 Fix aggregation functions to properly handle nil or indefined values.
1163 (Maxime Garcia)
1164
1165 * \#1373 Warn if a scope overrides another scope.
1166
1167 * \#1372 Never persist when binding inside of a read attribute for validation.
1168
1169 * \#1358 Fixed type error on many to many synchronization when inverse_of is
1170 set to nil.
1171
1172 * \#1356 $in criteria can now be chained to non-complex criteria on the same
1173 key without error.
1174
1175 * \#1350, \#1351 Fixed errors in the string conversions of double quotes and
1176 tilde when paramterizing keys.
1177
1178 * \#1349 Mongoid documents should not blow up when including Enumerable.
1179 (Jonas Nicklas)
1180
ab74efb Update master changelog
Dave Krupinski and Durran Jordan authored
1181 ## 2.2.3
1182
1183 * \#1295 Fixed having multiple includes only execute the eager loading of the first.
1184
1185 * \#1225 Fixed delayed persistence of embedded documents via $set.
1186
1187 * \#1002 Fix BSON object id conversion to check if legal first.
e34f140 @durran Merge changelog
durran authored
1188
0386f21 @durran Updating changelog for 2.2.2 notes
durran authored
1189 ## 2.2.2
1190
1191 * This release removes the restriction of a dependency on 1.3.x of the mongo
1192 ruby driver. Users may now use 1.3.x through 1.4.x.
1193
f325f06 @durran Updating changelog with dot notation fixes. Closes #1210. Closes #517.
durran authored
1194 ## 2.2.1
1195
2a5fb23 @durran Updating changelog for 2.2.1
durran authored
1196 ### Resolved Issues
1197
f325f06 @durran Updating changelog with dot notation fixes. Closes #1210. Closes #517.
durran authored
1198 * \#1210, \#517 Allow embedded document relation queries to use dot notation.
1199 (Scott Ellard)
1200
d16adf8 @durran Updating changelog
durran authored
1201 * \#1198 Enumerable target should use criteria count if loaded has no docs.
1202
2a5fb23 @durran Updating changelog for 2.2.1
durran authored
1203 * \#1164 Get rid of remaining no method in_memory errors.
c0a6e6c @durran Ensure all integer fields convert n precision 0 floats to an int. Fix…
durran authored
1204
2a5fb23 @durran Updating changelog for 2.2.1
durran authored
1205 * \#1070 Allow custom field serializers to have their own constructors.
1206
1207 * \#1176 Allow access to parent documents from embedded docs in after_destroy
1208 callbacks.
1209
1210 * \#1191 Context group methods (min, max, sum) no longer return NaN but instead
1211 return nil if field doesn't exist or have values.
1212
1213 * \#1193, \#1271 Always return Integers for integer fields with .000 precisions,
1214 not floats.
1215
1216 * \#1199 Fixed performance issues of hash and array field access when reading
1217 multiple times.
1218
1219 * \#1218 Fixed issues with relations referencing models with integer foreign keys.
1220
1221 * \#1219 Fixed various conflicting modifications issues when pushing and pulling
1222 from the same embedded document in a single call.
1223
1224 * \#1220 Metadata should not get overwritten by nil on binding.
1225
1226 * \#1231 Renamed Mongoid's atomic set class to Sets to avoid conflicts with Ruby's
1227 native Set after document inclusion.
1228
1229 * \#1232 Fix access to related models during before_destroy callbacks when
1230 cascading.
1231
1232 * \#1234 Fixed HABTM foreign key synchronization issues when destroying
1233 documents.
1234
1235 * \#1243 Polymorphic relations dont convert to object ids when querying if the
1236 ids are defined as strings.
1237
1238 * \#1247 Force Model.first to sort by ascending id to guarantee first document.
1239
1240 * \#1248 Added #unscoped to embedded many relations.
1241
1242 * \#1249 Destroy flags in nested attributes now actually destroy the document
1243 for has_many instead of just breaking the relation.
1244
1245 * \#1272 Don't modify configuration options in place when creating replica set
1246 connections.
f325f06 @durran Updating changelog with dot notation fixes. Closes #1210. Closes #517.
durran authored
1247
a11cc27 @gmile Changelog: rdoc -> md
gmile authored
1248 ## 2.2.0
1249
1250 ### New Features
1251
75f2651 @durran Updating changelog error in includes syntax.
durran authored
1252 * Mongoid now contains eager loading in the form of `Criteria#includes(*args)`.
140f31f @durran Updating changelog includes example.
durran authored
1253 This works on has_one, has_many, belongs_to associations and requires the identity map to
a11cc27 @gmile Changelog: rdoc -> md
gmile authored
1254 be enabled in order to function. Set `identity_map_enabled: true` in your
140f31f @durran Updating changelog includes example.
durran authored
1255 `mongoid.yml`. Ex: `Person.where(title: "Sir").includes(:posts, :game)`
a11cc27 @gmile Changelog: rdoc -> md
gmile authored
1256
1257 * Relations can now take a module as a value to the `:extend` option. (Roman
1258 Shterenzon)
1259
1260 * Capped collections can be created by passing the options to the `#store_in`
1261 macro: `Person.store_in :people, capped: true, max: 1000000`
1262
a4e2b38 @durran Updating changelog before I start forgetting things.
durran authored
1263 * Mongoid::Collection now supports `collection.find_and_modify`
1264
1265 * `Document#has_attribute?` now aliases to `Document#attribute_present?`
1266
1267 * \#930 You can now turn off the Mongoid logger via the mongoid.yml by
1268 doing `logger: false`
1269
1270 * \#909 We now raise a `Mongoid::Errors::Callback` exception if persisting with
1271 a bang method and a callback returns false, instead of the uninformative
1272 validations error from before.
1273
1274 ### Major Changes
1275
1276 * \#1173 has_many relations no longer delete all documents on a set of the relation
1277 (= [ doc_one, doc_two ]) but look to the dependent option to determine what
1278 behaviour should occur. :delete and :destroy will behave as before, :nullify and
1279 no option specified will both nullify the old documents without deleting.
1280
1281 * \#1142, \#767 Embedded relations no longer immediately persist atomically
1282 when accessed via a parent attributes set. This includes nested attributes setting
1283 and `attributes=` or `write_attributes`. The child changes then remain dirty and
1284 atomically update when save is called on them or the parent document.
1285
1286 ### Resolved Issues
1287
1288 * \#1190 Fixed the gemspec errors due to changing README and CHANGELOG to markdown.
1289
1290 * \#1180, \#1084, \#955 Mongoid now checks the field types rather than if the name
1291 contains `/id/` when trying to convert to object ids on criteria.
1292
1293 * \#1176 Enumerable targets should always return the in memory documents first,
1294 when calling `#first`
1295
1296 * \#1175 Make sure both sides of many to many relations are in sync during a create.
1297
1298 * \#1172 Referenced enumerable relations now properly handle `#to_json`
1299 (Daniel Doubrovkine)
1300
1301 * \#1040 Increased performance of class load times by removing all delegate calls
1302 to self.class.
1303
a11cc27 @gmile Changelog: rdoc -> md
gmile authored
1304 ## 2.1.9
1305
1306 ### Resolved Issues
1307
1308 * \#1159 Fixed build blocks not to cancel out each other when nested.
1309
1310 * \#1154 Don't delete many-to-many documents on empty array set.
1311
1312 * \#1153 Retain parent document reference in after callbacks.
1313
1314 * \#1151 Fix associated validation infinite loop on self referencing documents.
1315
1316 * \#1150 Validates associated on `belongs_to` is `false` by default.
1317
1318 * \#1149 Fixed metadata setting on `belongs_to` relations.
1319
1320 * \#1145 Metadata inverse should return `nil` if `inverse_of` was set as `nil`.
1321
1322 * \#1139 Enumerable targets now quack like arrays.
1323
1324 * \#1136 Setting `belongs_to` parent to `nil` no longer deletes the parent.
1325
1326 * \#1120 Don't call `in_memory` on relations if they don't respond to it.
1327
1328 * \#1075 Set `self` in default procs to the document instance.
1329
1330 * \#1072 Writing attributes for nested documents can take a hash or array of hashes.
1331
1332 * \#990 Embedded documents can use a single `embedded_in` with multiple parent definitions.
1333
1334 ## 2.1.8
1335
1336 ### Resolved Issues
1337
1338 * \#1148 Fixed `respond_to?` on all relations to return properly.
1339
1340 * \#1146 Added back the Mongoid destructive fields check when defining fields.
1341
1342 * \#1141 Fixed conversions of `nil` values in criteria.
1343
1344 * \#1131 Verified Mongoid/Kaminari paginating correctly.
1345
1346 * \#1105 Fixed atomic update consumer to be scoped to class.
1347
1348 * \#1075 `self` in default lambdas and procs now references the document instance.
1349
1350 * \#740 Removed `embedded_object_id` configuration parameter.
1351
1352 * \#661 Fixed metadata caching on embedded documents.
1353
1354 * \#595 Fixed relation reload flagging.
1355
1356 * \#410 Moving documents from one relation to another now works as expected.
1357
1358 ## 2.1.7
1359
1360 This was a specific release to fix MRI 1.8.7 breakages introduced by 2.1.6.
1361
1362 ## 2.1.6
1363
1364 ### Resolved Issues
1365
1366 * \#1126 Fix setting of relations with other relation proxies.
1367
1368 * \#1122 Hash and array fields now properly flag as dirty on access and change.
1369
1370 * \#656 Fixed reload breaking relations on unsetting of already loaded associations.
1371
1372 * \#647 Prefer `#unset` to `#remove_attribute` for removing values.
1373
1374 * \#290 Verify pushes into deeply embedded documents.
1375
1376 ## 2.1.5
1377
1378 ### Resolved Issues
1379
1380 * \#1116 Embedded children retain reference to parent in destroy callbacks.
1381
1382 * \#1110, \#1115 Don't memoize metadata related helpers on documents.
1383
1384 * \#1112 `db:create_indexes` no longer indexes subclasses multiple times.
1385
1386 * \#1111, \#1098 Don't set `_id` in `$set` operations.
1387
1388 * \#1007 Update attribute properly tracks array changes.
1389
1390 ## 2.1.4
1391
1392 This was a specific release to get a Psych generated gemspec so no more parse errors would occur on those rubies that were using the new YAML parser.
1393
1394 ## 2.1.3
1395
1396 ### Resolved Issues
1397
1398 * \#1109 Fixed validations not loading one to ones into memory.
1399
1400 * \#1107 Mongoid no longer wants required `mongoid/railtie` in `application.rb`.
1401
1402 * \#1102 Fixed nested attributes deletion.
1403
1404 * \#1097 Reload now runs `after_initialize` callbacks.
1405
1406 * \#1079 Embeds many no longer duplicates documents.
1407
1408 * \#1078 Fixed array criteria matching on embedded documents.
1409
1410 * \#1028 Implement scoped on one-to-many and many-to-many relations.
1411
1412 * \#988 Many-to-many clear no longer deletes the child documents.
1413
1414 * \#977 Autosaving relations works also through nested attributes.
1415
1416 * \#972 Recursive embedding now handles namespacing on generated names.
1417
1418 * \#943 Don't override `Document#attributes`.
1419
1420 * \#893 Verify count is not caching on many to many relations.
1421
1422 * \#815 Verify `after_initialize` is run in the correct place.
1423
1424 * \#793 Verify `any_of` scopes chain properly with any other scope.
1425
1426 * \#776 Fixed mongoid case quality when dealing with subclasses.
1427
1428 * \#747 Fixed complex criteria using its keys to render its string value.
1429
1430 * \#721 `#safely` now properly raises validation errors when they occur.
1431
1432 ## 2.1.2
1433
1434 ### Resolved Issues
1435
1436 * \#1082 Alias `size` and `length` to `count` on criteria. (Adam Greene)
1437
1438 * \#1044 When multiple relations are defined for the same class, always return the default inverse first if `inverse_of` is not defined.
1439
1440 * \#710 Nested attributes accept both `id` and `_id` in hashes or arrays.
1441
1442 * \#1047 Ignore `nil` values passed to `embeds_man` pushes and substitution. (Derick Bailey)
1443
1444 ## 2.1.1
1445
1446 ### Resolved Issues
1447
1448 * \#1021, \#719 Many to many relations dont trigger extra database queries when pushing new documents.
1449
1450 * \#607 Calling `create` on large associations does not load the entire relation.
1451
1452 * \#1064 `Mongoid::Paranoia` should respect `unscoped` and `scoped`.
1453
1454 * \#1026 `model#update_attribute` now can update booleans to `false`.
1455
1456 * \#618 Crack XML library breaks Mongoid by adding `#attributes` method to the `String` class. (Stephen McGinty)
1457
1458 ## 2.1.0
1459
1460 ### Major Changes
1461
1462 * Mongoid now requires MongoDB 1.8.x in order to properly support the `#bit` and `#rename` atomic operations.
1463
1464 * Traditional slave support has been removed from Mongoid. Replica sets should be used in place of traditional master and slave setups.
1465
1466 * Custom field serialization has changed. Please see [serializable](https://github.com/mongoid/mongoid/blob/master/lib/mongoid/fields/serializable.rb) for changes.
1467
1468 * The dirty attribute tracking has been switched to use ActiveModel, this brings many bug fixes and changes:
1469
1470 * \#756 After callbacks and observers see what was changed instead of changes just made being in previous_changes
1471
1472 * \#434 Documents now are flagged as dirty when brand new or the state on instantiation differs from the database state. This is consistent with ActiveRecord.
1473
1474 * \#323 Mongoid now supports [field]_will_change! from ActiveModel::Dirty
1475
1476 * Mongoid model preloading in development mode now defaults to `false`.
1477
1478 * `:autosave => true` on relational associations now saves on update as well as create.
1479
1480 * Mongoid now has an identity map for simple `find_by_id` queries. See the website for documentation.
1481
1482 ### New Features
1483
1484 * \#1067 Fields now accept a `:versioned` attribute to be able to disable what fields are versioned with `Mongoid::Versioning`. (Jim Benton)
1485
1486 * \#587 Added order preference to many and many to many associations. (Gregory Man)
1487
1488 * Added ability to chain `order_by` statements. (Gregory Man)
1489
1490 * \#961 Allow arbitrary `Mongo::Connection` options to pass through `Mongoid::Config::Database` object. (Morgan Nelson)
1491
1492 * Enable `autosave` for many to many references. (Dave Krupinski)
1493
1494 * The following explicit atomic operations have been added: `Model#bit`, `Model#pop`, `Model#pull`, `Model#push_all`, `Model#rename`, `Model#unset`.
1495
1496 * Added exception translations for Hindi. (Sukeerthi Adiga)
1497
1498 ### Resolved Issues
1499
1500 * \#974 Fix `attribute_present?` to work correctly then attribute value is `false`, thanks to @nickhoffman. (Gregory Man)
1501
1502 * \#960 create indexes rake task is not recognizing a lot of mongoid models because it has problems guessing their model names from filenames. (Tobias Schlottke)
1503
1504 * \#874 Deleting from a M-M reference is one-sided. (nickhoffman, davekrupinski)
1505
1506 * Replace deprecated `class_inheritable_hash` dropped in Rails 3.1+. (Konstantin Shabanov)
1507
1508 * Fix inconsistent state when replacing an entire many to many relation.
1509
1510 * Don't clobber inheritable attributes when adding subclass field inheritance. (Dave Krupinski)
1511
1512 * \#914 Querying embedded documents with `$or` selector. (Max Golovnia)
1513
1514 * \#514 Fix marshaling of documents with relation extensions. (Chris Griego)
1515
1516 * `Metadata#extension` now returns a `Module`, instead of a `Proc`, when an extension is defined.
1517
1518 * \#837 When `allow_dynamic_fields` is set to `false` and loading an embedded document with an unrecognized field, an exception is raised.
1519
1520 * \#963 Initializing array of embedded documents via hash regressed (Chris Griego, Morgan Nelson)
1521
1522 * `Mongoid::Config.reset` resets the options to their default values.
1523
1524 * `Mongoid::Fields.defaults` is memoized for faster instantiation of models.
Something went wrong with that request. Please try again.