|
|
Enum type manager. It creates a separated class to hold each enum set, that can be used by multiple models, and also keeps the database data consistent. The enum type is shown to have a better performance against string- and integer-like enums.
|
|
|
Enum type manager. It creates a separated class to hold each enum set that can be used by multiple models, it also keeps the database data consistent. The enum type is known to have a better performance against string- and integer-like enums. [PostgreSQL Docs](https://www.postgresql.org/docs/9.2/static/datatype-enum.html)
|
|
|
|
|
|
# How it works
|
|
|
|
|
|
### Migration
|
|
|
|
|
|
First you have to create the enum during your migration, since the database that holds the list of possible values.
|
|
|
First you have to create the enum during your migration, since it's the database that holds the list of possible values.
|
|
|
```ruby
|
|
|
create_enum :status, %i(created draft published archived)
|
|
|
```
|
... | ... | |