@@ -57,6 +57,39 @@ changed in Mongoid 8.0:
5757Please refer to :ref:`configuration option <configuration-options>` for
5858the description and effects of each of these options.
5959
60+ Storing Uncastable Value
61+ ------------------------
62+
63+ In Mongoid 8, Mongoid standardizes the storing of "uncastable values." On
64+ attempting to write an uncastable value, a ``nil`` is written instead. See the
65+ secion on :ref:`Uncastable Values <uncastable-values>` for more details.
66+
67+ Some ``mongoize`` methods were also changed to perform consistently with rails
68+ and the other mongoize methods. The following is a table of the changes in
69+ functionality:
70+
71+ +--------------+------------------------+------------------------+-------------------+
72+ | Field Type | Situation | Previous Functionality | New Functionality |
73+ +==============+========================+========================+===================+
74+ | Boolean | When a non-boolean | return ``false`` | return ``nil`` |
75+ | | string is assigned: | | |
76+ | | "bogus value" | | |
77+ +--------------+------------------------+------------------------+-------------------+
78+ | Symbol | When a value that does | return ``nil`` | return ``nil`` |
79+ | | not respond to | | |
80+ | | ``to_sym`` is | | |
81+ | | assigned: ``[]`` | | |
82+ +--------------+------------------------+------------------------+-------------------+
83+ | Array/Set | When a value that is | raise ``InvalidValue`` | return ``nil`` |
84+ | | not an array or set is | error | |
85+ | | assigned, and does NOT | | |
86+ | | respond to ``to_a``: 1 | | |
87+ +--------------+------------------------+------------------------+-------------------+
88+ | All Other | When an uncastable | undefined behavior, | return ``nil`` |
89+ | Types | value is assigned | occasionally raises | |
90+ | | | ``NoMethodError`` | |
91+ +--------------+------------------------+------------------------+-------------------+
92+
6093
6194Order of Callback Invocation
6295----------------------------
0 commit comments