Skip to content

can't modify frozen hash error from #serializable_attributes in Rails 8 #140

@dbackeus

Description

@dbackeus

When attempting to upgrade an app using active_model_otp to Rails 8 we started seeing error: can't modify frozen Hash errors when passing options into to_json on a model with has_one_time_password.

The error triggers at:
https://github.com/heapsource/active_model_otp/blob/main/lib/active_model/one_time_password.rb#L118

It seems that Rails 8 freezes incoming options for #serializable_attributes, making this mutation illegal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions