We have an App using the jsonb_accessor
gem.
As an example we use something like this in our project.
jsonb_accessor :user_data, gender: :string
enum gender: { male: 'male', female: 'female' }
After upgrading to Rails 7.1 (with this commit: https://github.com/rails/rails/commit/6c5fab0668c1872fe827507f45ef400a20e8c646) we are getting an error:
Unknown enum attribute 'gender' for User (RuntimeError)
Does anyone have a similar problem and found a solution for this?
Thank you in advance.
Kind regards, pabse
To complete this thread:
This feature will be added to rails again with PR#49769
You just have to declare the type before.
class Post < ActiveRecord::Base
attribute :topic, :string
enum topic: %i[science tech engineering math]
end