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.