diff options
author | Godfrey Chan <godfreykfc@gmail.com> | 2014-08-10 20:31:10 -0700 |
---|---|---|
committer | Godfrey Chan <godfreykfc@gmail.com> | 2014-08-10 20:31:10 -0700 |
commit | 49798b52bfaaa452f1c535ca932cc267482348fe (patch) | |
tree | 457214fc3a53f48c3d100304ef42bf33ee9a3a40 | |
parent | 7bd9c874c6b9eca045896d5fff5e50f0aea42fda (diff) | |
parent | 4bfd0cef5bc0e6c052f8683ac0510845b7748a72 (diff) | |
download | rails-49798b52bfaaa452f1c535ca932cc267482348fe.tar.gz rails-49798b52bfaaa452f1c535ca932cc267482348fe.tar.bz2 rails-49798b52bfaaa452f1c535ca932cc267482348fe.zip |
Merge pull request #16300 from vast/mention-changes-to-nil-serialization-in-upgrading-from-3.2
Mention changes to `nil` handling in serialized attributes
-rw-r--r-- | guides/source/upgrading_ruby_on_rails.md | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index 62e4071935..cc20782780 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -54,7 +54,8 @@ NOTE: This section is a work in progress. ### Serialized attributes -When assigning `nil` to a serialized attribute, it will be saved to the database +When using a custom coder (e.g. `serialize :metadata, JSON`), +assigning `nil` to a serialized attribute will save it to the database as `NULL` instead of passing the `nil` value through the coder (e.g. `"null"` when using the `JSON` coder). @@ -624,6 +625,9 @@ Rails 4.0 no longer supports loading plugins from `vendor/plugins`. You must rep * Rails 4.0 has changed `serialized_attributes` and `attr_readonly` to class methods only. You shouldn't use instance methods since it's now deprecated. You should change them to use class methods, e.g. `self.serialized_attributes` to `self.class.serialized_attributes`. +* When using the default coder, assigning `nil` to a serialized attribute will save it +to the database as `NULL` instead of passing the `nil` value through YAML (`"--- \n...\n"`). + * Rails 4.0 has removed `attr_accessible` and `attr_protected` feature in favor of Strong Parameters. You can use the [Protected Attributes gem](https://github.com/rails/protected_attributes) for a smooth upgrade path. * If you are not using Protected Attributes, you can remove any options related to |