Skip to content
  • Jon Moss's avatar
    077367f2
    Add note about JSON/JSONB serialization changes · 077367f2
    Jon Moss authored
    The initial commit (efaa6e4f) that changed this
    behavior was intended to be a minor change, but ended up becoming a
    large-ish breaking change within Active Record.
    
    This is because instead of only JSON encoding `Hash`es or `Array`s in `#serialize`,
    we now encode all values passed in. This is an issue if you're passing in a `String`,
    that has already been transformed from a `Hash` to a `String`, since your data
    is now being double encoded.
    
    Unfortunately, the change was included in one of the v5.0.0 beta
    releases, and it is too late to revert without huge ripple effects.
    Thus, all we can do is update the documentation (via this commit), and
    add some test coverage (coming soon in a PR) for the new behavior.
    
    Please note that in the documentation I talk about deserialization, not
    about serialization, where the actual change occurred. This is because
    you won't notice any changes in serialized data until you try and
    deserialize it. Also to make the change itself (confusing until you
    read through everything multiple times) easier to understand.
    
    Related #27788, #25594, #26101, #24234, #28292, #28285, #28285, and
    probably others.
    
    [ci skip]
    077367f2
    Add note about JSON/JSONB serialization changes
    Jon Moss authored
    The initial commit (efaa6e4f) that changed this
    behavior was intended to be a minor change, but ended up becoming a
    large-ish breaking change within Active Record.
    
    This is because instead of only JSON encoding `Hash`es or `Array`s in `#serialize`,
    we now encode all values passed in. This is an issue if you're passing in a `String`,
    that has already been transformed from a `Hash` to a `String`, since your data
    is now being double encoded.
    
    Unfortunately, the change was included in one of the v5.0.0 beta
    releases, and it is too late to revert without huge ripple effects.
    Thus, all we can do is update the documentation (via this commit), and
    add some test coverage (coming soon in a PR) for the new behavior.
    
    Please note that in the documentation I talk about deserialization, not
    about serialization, where the actual change occurred. This is because
    you won't notice any changes in serialized data until you try and
    deserialize it. Also to make the change itself (confusing until you
    read through everything multiple times) easier to understand.
    
    Related #27788, #25594, #26101, #24234, #28292, #28285, #28285, and
    probably others.
    
    [ci skip]
Loading