Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix regression in serialization of nil/NULL values
Regression introduced in #5012e0d6. This change partially reverts the change such that it works for Rails 6.1/7.0 and 7.1+. In Rails 7.1+ the API for `.serialize` changed. At first using `serialize :parameters, coder: YAML, type: Hash` seems to be backwards compatible with Rails 6.1/7.0 when reading the documentation/code but there’s a subtle difference: when the 2nd positional parameter (denoting the target type) is not provided a default mechanism is used. While the defaults will use `YAML` as the coder the serialization will only occur if the column is not `NULL`. So, without an explicit type parameter `nil`/`NULL` values are not converted to `Hash`. Thus, the explicit type parameter acts as the fallback for the value itself. Fixes #386 #384 #382
- Loading branch information