I wanted to get the array of symbols(:foo,:bar) available in an Enum field(:status).
class MyModel < ActiveRecord::Base
enum status: [:foor, :bar]
end
As explained in the Enum guide, if you have an enum field called status you access the mapping using the plural form:
MyModel.statuses
=> {"foor"=>0, "bar"=>1}
The keys are the enum values, the values are an incremental integer assigned based on the order of the enum definition.
MyModel.statuses.keys.map(&:to_sym)