... | ... | @@ -74,6 +74,9 @@ Enum::Roles.admin |
|
|
# Or you can get the list of values
|
|
|
Enum::Roles.values
|
|
|
|
|
|
# You can also get all the values as symbols
|
|
|
Enum::Roles.keys
|
|
|
|
|
|
# Allows you to iterate over the values directly from the class
|
|
|
Enum::Roles.each do |role|
|
|
|
puts role
|
... | ... | @@ -96,7 +99,8 @@ end |
|
|
|
|
|
You are able to access the list of values trough the class that holds the enum:
|
|
|
```ruby
|
|
|
User.roles
|
|
|
User.roles # List of strings
|
|
|
User.roles_keys # List of symbols
|
|
|
```
|
|
|
|
|
|
You can set the column value from `String`, `Symbol`, and `Integer`:
|
... | ... | |