Typically, in Ruby, enumerated attributes are implemented with strings, symbols or constants. Often the developer is burdened with repeatedly defining common methods in support of each attribute. enumerated_attribute provides a DRY implementation for enumerations in Rails. Repetitive code such as initializers, accessors, predicate and enumeration methods are automatically generated along with the following features:
- ActiveRecord integration
- ActionView form helpers
- Scaffold generator integration
- Definable enumeration labels
- Enum helper methods
- Dynamic predicate methods
- Initialization
- State pattern support (enumerated_state)
No comments:
Post a Comment