cgriego/active_attr — Issue #76: Enums support
Author: dnagir
Created: 2012-02-17 11:17:04+00:00
State: open

Ability to write something like:

```
class Filter
include ActiveAttr::Model

attribute :status, default: :all, enum: [:all, :available, :unavailable]
end
```

This would give us:

- `Filter#status_name` that is i8n translated based on the value of `Filter#status`.
- `Filtet#status_hashes` - the hash that can be used on the views.
- Assigning any valid outside of the given range would throw by default.
- Ability to use it with ActiveModel as well as ActiveRecord (and hooks for other ORMs if possible).

There's [simple_enum](https://github.com/lwe/simple_enum) and similar, but those seem to be tight to AR.

The implementation is pretty straightforward (for AR-only). [This is what I'm currently using](https://gist.github.com/1775540) which may be a good start.