Enums
Clear offers support of PG enum.
To define an enum, use the Clear.enum
method:
This will create a new record called MyApp::Gender
, which contains the constants Male
and Female
.
Validation, assignation
You can use the new type directly in your model:
Assignation cannot be made from string, but instead from constants:
List of helpers are present for validation and conversion from/to string:
Migration
Last updated