Module: Comee::Core::ActiveModelSerializersFrozenOptionsPatch
- Defined in:
- lib/comee/core/active_model_serializers_frozen_options_patch.rb
Overview
Rails 8.1's ActiveSupport::JSON encoder freezes the options hash it passes to
as_json (see ActiveSupport::JSON::Encoding::JSONGemEncoder#encode). active_model_serializers
0.10.x (unmaintained since 2022) mutates that options hash while building the
serializable hash, which raises FrozenError. Duping here restores the old behavior
without touching the gem itself.
Instance Method Summary collapse
Instance Method Details
#serializable_hash(options = nil) ⇒ Object
9 10 11 12 |
# File 'lib/comee/core/active_model_serializers_frozen_options_patch.rb', line 9 def serializable_hash( = nil) = .dup if &.frozen? super() end |