Rails Serialize Activerecord Object
'If classname is specified, the serialized object must be of that class onassignment and retrieval.' Does cover this, but you're right, it could be alot clearer.Keep in mind we are actively discouraging the use of serialize for newapps.That said, feel free to open a PR to improve the documentation.On Mon, Jun 8, 2015, 9:20 PM Diego Carrion wrote:Sorry, is this the documentation?In case it this, maybe I'am misunderstanding the documentation, but Idon't see how this current behaviour is documented.—Reply to this email directly or view it on GitHub. `serialize` makes the contract that if it is given a class name, it willnever return something other than an instance of that class. This meansthat it must cast `nil` to the empty form of that object. As such, weshould then persist empty forms of that object as `nil`.
Rails Serialize Activerecord Object List
While this istechincally under the contract of```model.attribute = valueassertequal model.attribute, model.tap(&:save).reload.attribute```which we can't actually test universally without property based testing,it has come up more than once and is worth calling out specificallysince we aren't looking to change it.