Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rails 8.0.0] Can't modify frozen Hash serialization_context ActiveModelSerializers::SerializationContext #2485

Closed
scottohara-frollo opened this issue Nov 30, 2024 · 2 comments

Comments

@scottohara-frollo
Copy link

Expected behavior vs actual behavior

After upgrading to Rails 8.0.0, all serializers fail when a controller calls render json: <model instance> with the error:

can't modify frozen Hash: {:serialization_context=>#<ActiveModelSerializers::SerializationContext:0x000000012b99a008 @request_url="http://127.0.0.1:3000/things/1", @query_parameters={}, @url_helpers=#<Module:0x0000000128bf4ec8>, @default_url_options={}>, :namespace=>nil}

Same application/serializers works fine with Rails 7.2.1.1.

(If you believe that this issue should instead be reported to rails/rails, please feel free to close as such)

Steps to reproduce

rails _8.0.0_ new MyApp --api
bundle add active_model_serializers
rails generate scaffold Thing name:string
rake db:migrate
rails console <<< 'Thing.create!(name: "test")'
rails server
curl http://127.0.0.1:3000/things/1

Environment

ActiveModelSerializers Version (commit ref if not on tag): 0.10.14

Output of ruby -e "puts RUBY_DESCRIPTION": ruby 3.3.6 (2024-11-05 revision 75015d4c1f) [arm64-darwin24]

OS Type & Version: macOS 15.1.1

Integrated application and version (e.g., Rails, Grape, etc): Rails 8.0.0

@scottohara-frollo
Copy link
Author

(Sorry, accidentally created using the wrong user account. Will close and recreate with a different user.)

@scottohara-frollo scottohara-frollo closed this as not planned Won't fix, can't repro, duplicate, stale Nov 30, 2024
@bf4
Copy link
Member

bf4 commented Dec 1, 2024

Should be fixed in 0.10.15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants