-
Notifications
You must be signed in to change notification settings - Fork 33
Description
Thanks for this gem. It's a great help in my current project. But I would like to answer @adzap in issue #21 in hopes of restarting the idea. The use case is readability of the underlying database. If I set up an enum for genders, the states or provinces of a country, race/ethnic groups, etc., and the database is used by non-Rails applications, it's much cleaner if the value e.g. New York corresponds to an id that's an understandable abbreviation e.g. 'ny' rather than an integer. This is best practice in database design. I hope you'll consider allowing string values in the next version. Your proposal will work fine: Enum.id(name) and Enum.name(id) . You could retain the bracket notation and raise an exception if the user tries to use it on an enum that has string ids. If I have time I'll take a crack at it in a fork.