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 support #2488

Closed
JensDebergh opened this issue Feb 19, 2025 · 5 comments
Closed

Rails 8 support #2488

JensDebergh opened this issue Feb 19, 2025 · 5 comments

Comments

@JensDebergh
Copy link

Hi everyone!

I know this library isn't actively developed anymore, but I'm using this on an app with over 100 records and controllers, so I can't just swap it out easily.

Currently I'm in the progress of upgrading to rails 8 and stumbled on following error:

FrozenError - can't modify frozen Hash: {serialization_context: #<ActiveModelSerializers::SerializationContext:0x000000015713c808 @request_url="http://localhost:3000/api/calendar", @query_parameters={"start" => "2025-02-18T23:00:00.000Z", "end" => "2025-02-19T22:59:59.999Z"}, @url_helpers=#<Module:0x00000001412b8990>, @default_url_options={host: "localhost:3000"}>, namespace: Api}:
  app/controllers/api/calendar_controller.rb:282:in `index'

Rails 8 got more strict with frozen hashes and it seems activemodel serializer tries to modify a hash that was originally frozen.

If anyone could point me in the right direction, I would be happy to wip up a merge request to fix the issue for rails 8 users to atleast get it in a workable state.

@wasifhossain
Copy link
Member

which AMS version are you using please?

@wasifhossain
Copy link
Member

fyi, AMS 0-10-stable already supports Rails 8: #2483

@JensDebergh
Copy link
Author

I'm currently on gem "active_model_serializers", "~> 0.10.13"

@wasifhossain
Copy link
Member

can you help reproducing the case somehow? even better if you could add a test in a PR.

@JensDebergh
Copy link
Author

Apologies, I have a working solution now by targeting the git repo and branch 0.10-stable 🙏

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