File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ The valid types for fields are as follows:
7777- ``Regexp``
7878- ``Set``
7979- ``String``
80- - ``Mongoid::StringifiedSymbol``, which may be specified simply as
80+ - ``Mongoid::StringifiedSymbol``, which may be specified simply as
8181 ``StringifiedSymbol`` in the scope of a class which included
8282 ``Mongoid::Document``.
8383- ``Symbol``
@@ -1304,6 +1304,19 @@ a ``ReadonlyAttribute`` exception will be raised:
13041304 band.update_attribute(:name, "Tool") # Raises the error.
13051305 band.remove_attribute(:name) # Raises the error.
13061306
1307+ Assignments to read-only attributes using their setters will be ignored:
1308+
1309+ .. code-block:: ruby
1310+
1311+ b = Band.create!(name: "The Rolling Stones")
1312+ # => #<Band _id: 6287a3d5d1327a5292535383, name: "The Rolling Stones", origin: nil>
1313+ b.name = "The Smashing Pumpkins"
1314+ # => "The Smashing Pumpkins"
1315+ b.name
1316+ # => "The Rolling Stones"
1317+
1318+ Calls to atomic persistence operators, like ``bit`` and ``inc``, will persist
1319+ changes to readonly fields.
13071320
13081321Timestamp Fields
13091322================
You can’t perform that action at this time.
0 commit comments