I'm working on versioning models in an old project. almost all of the enum's values used in the project are integers. when tracking changes with object_changes the values are displayed as integers, which is not clear to the end user viewing this data.
for example
class Article
has_paper_trail
enum status: {draft: 0, published: 1}
end
the record is saved with object changes status :[0,1]
is there a way either to save or display the status key instead of the value?
You can obtain the readable form of the enum value by using the following code.
To go even further, migrate your data and define your enums for 'status' as follows.
Rails will save the values as strings; therefore, its attribute must have a compatible data type.