Skip to content

Conversation

tomukas
Copy link

@tomukas tomukas commented Nov 13, 2024

Original code doesnt work well with Rails 8.0.0

For example:
in ruby console: User.all.to_json(only: [:id, :name])
Returns error can't modify frozen Hash: {:only=>[:id, :name]} (FrozenError)

This PR will fix it.

@scpike
Copy link

scpike commented Jul 16, 2025

I can confirm this patch is necessary for Rails 8 compatibility. The underlying change is here: rails/rails#52826 (review).

This seems like a fine solution, it's similar to what active_model_serializers did at https://github.com/rails-api/active_model_serializers/pull/2482/files

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

Successfully merging this pull request may close these issues.

2 participants