The enum defined like this:
enum status: %i[pending unfinished finished]
You can get the integer like so:
my_model = MyModel.find(123)
my_model[:status] # Returns the integer value
my_model.status_before_type_cast # Returns the integer value
Also, you can get the integer values for an enum from the class the enum is on:
MyModel.statuses
# => {"pending"=>0, "unfinished"=>1, "finished"=>2}
my_model = MyModel.find(123)
MyModel.statuses[my_model.status] # Returns the integer value