Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As a result of Rails PR#47463, serialization is now type-checked, and so the approach of dynamically deciding when calling
#load
and#dump
no longer works.This means that you'll get the following errors/deprecation warnings when using Edge Rails with Audited:
And:
(The first is just a syntax thing to be fair)
I don't know the best way to fix it to be honest - determining the column type would require connecting to the database on load, so that's sub-optimal. It might be possible to implement a
Coder
class that dynamically switches and passes the type checking?This is the commit I'm using, which adds a configuration setting to choose json encoding by default (replaces the existing approach). This seems like something worth considering as it seems Rails has moved away from YAML for good reasons too.
I've sent the PR in case it's useful, but of course it's a breaking change and I think there might be a better approach - figured I'd start the discussion anyway 😄
Thank you!