... | ... | @@ -4,7 +4,7 @@ Enum type manager. It creates a separated class to hold each enum set that can b |
|
|
|
|
|
### Migration
|
|
|
|
|
|
First you have to create the enum during your migration, since it's 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 :roles, %i(visitor manager admin)
|
|
|
```
|
... | ... | @@ -44,9 +44,9 @@ create_table :users do |t| |
|
|
end
|
|
|
```
|
|
|
|
|
|
### The type class
|
|
|
### The type Class
|
|
|
|
|
|
Each enum type loaded from the database will have it's own class type of value, created under the [`enum.namespace`](https://github.com/crashtech/torque-postgresql/wiki/Configuring#enum.namespace) namespace.
|
|
|
Each enum type loaded from the database will have its own class type of value, created under the [`enum.namespace`](https://github.com/crashtech/torque-postgresql/wiki/Configuring#enum.namespace) namespace.
|
|
|
```ruby
|
|
|
Enum::Roles
|
|
|
|
... | ... | |