bugfix: form_value use enum value not the key in active_record #2659
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
when i use enum feature in my active record, the value of the select in form is '' because the value option of the select is enum's value not the key.
eg: there is a Product model with enum status: {spare: 1, on_sale: 2, off_sale: 3}
without this commit,
the status field is always null, because rails_admin form builder can't find the correct value for the select
with this commit,
it will find the correct value, so the select value will be filled correctly