-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Enum support #87
Comments
Hey what is the status of this feature? |
I tried this: jsonb_accessor :index_config,
index_scope: [:string, default: "off"],
multi_field_op: [:string, default: "or"]
enum index_scope: {
off: "off",
source: "source",
global: "global"
}, _prefix: :index
enum multi_field_op: {
combined_uniqueness: "and",
field_uniqueness: "or"
} Declare fields with Original proposal:
Rails enum: Model.last.update({index_scope: "bad option"})
ArgumentError: 'bad option' is not a valid index_scope |
As @preetsethi has demonstrated this works perfectly fine. Thanks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi!
I am interested in developing a sort of enum support for jsonb fields.
The use case:
A JSONB field key should be allowed to have one of a predefined set of (string) values.
Pseudocode of DSL:
Does this sound like something that would get added to this gem were I to make a PR?
The text was updated successfully, but these errors were encountered: