thetron / mongoid-enum

Sweet enum sugar for your Mongoid documents
MIT License
117 stars 167 forks source link

No support for explicitly mapped values #31

Open maxschmeling opened 8 years ago

maxschmeling commented 8 years ago

I get an error when trying to map enum values explicitly (as can be done with ActiveRecord::Enum).

For example:

# see https://en.wikipedia.org/wiki/ISO/IEC_5218
enum :sex, {
  unknown: 0,
  male: 1,
  female: 2,
  not_applicable: 9
}

The error is in create_validations:

undefined method `to_sym' for [:unknown, 0]:Array
utiq commented 5 years ago

Same, how can I do this?