Enum issues in Rails 7.1.2 and Ruby 3.2.1
rizbasharat786 opened this issue · 1 comments
enum :status_ids, {
pending: 0,
verified: 1,
work_in_progress: 2,
complete: 3
}
enum :type_ids, {
price_variance: 0,
oos_in_store: 1,
not_in_store_file: 2,
not_in_master_db: 3,
data_not_correct: 4
}
These are my enums but i'm facing this error:
declared attribute type for enum 'status_ids'. Enums must be backed by a database column or declared with an explicit type via
attribute. (RuntimeError)
I have tried attr_accessor, explicitly called status_ids and type_ids with attribute
I also don't want to use database columns as well
It looks like the error you're seeing is related to an upstream change in Rails itself, the error is coming from:
You can see here a discussion of the issue: rails/rails#49717
There's also a PR which was merged recently to move the enum
definition into ActiveModel
which is likely what you want: rails/rails#49769
As this isn't a problem with Administrate itself, I'm going to close this, but let us know if you see any other problems with enums
.