Stringify money BigDecimal value in Active Job serializer #253
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.
Sidekiq 7.0 by default enforces that values must be JSON safe: https://github.com/mperham/sidekiq/blob/v7.0.0/lib/sidekiq/job_util.rb#L68 (see sidekiq/sidekiq#5071) i.e. before and after a serialization roundtrip be exactly the same.
Before this fix ActiveJob enqueues a BigDecimal, which eventually does end up in the same string representation thanks to Active Support's extension: https://guides.rubyonrails.org/v7.0.0/active_support_core_extensions.html#extensions-to-bigdecimal with thix fix we do the same explicitly to make Sidekiq happy.
Since Money can handle well-formed string values there are no forwards or backwards compatibility problems.