thetron / mongoid-enum

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

Could not do mapping when using `.find_or_initialize_by(enum: 'enum_value')` #27

Open zdraganov opened 8 years ago

zdraganov commented 8 years ago

I reached a problem when doing

Model.find_or_initialize_by(enum_field: 'value')

it's not matching it. I saw that if I use _enum_field instead of enum_field it's working as expected.

My environment is: ruby (2.1.6) rails (3.2.15) mongoid (3.1.6) mongoid-enum (0.1.1)