Posts [ 2 ]

Topic: Handling distinct values (enums)

Hey all,

How does Ruby and/or Rails handle enum like values? I'm finding myself creating a lot of constants in my Models and then creating arrays from those constants in order to get what would be the same functionality as enums provide in other classes (such as C#). It's a lot of work for such a simple thing, so it seems like there should be a better way.

For example, my Message model (for internal email-type messages within the system) looks something like this