Most of the solutions here require you to have a record or model class in hand. Here is an approach where you can get the integer value from an enum without creating a record, by using Hash's .key
method:
sale_info.key('plan_3')
=> 3
This is particularly useful if you're doing some ETL and mapping raw values to/from string values between systems that depend on the numeric integer value and/or the string value in different scenarios.
Note that this is probably not highly performant, as searching for a value in a hash (as opposed to a key) is not efficient. If you're processing millions of values/second or have an enum with (yuck) hundreds of values, you'll probably want to build a new hash that inverts enum's values and keys so you can do efficient lookups in the opposite direction.