-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Bug: editing nullable boolean forces it to false #3145
Comments
What's the difference between having a boolean set as |
|
Yup, totally get that. However, how can you know if the value was set by the user as |
Maybe use 3 radio buttons? |
Good idea; When |
I ran into this same issue! While it is being worked on, I have a basic workaround:
Unfortunately, no option will show in the dropdown for 'Null', but the field will show 'Optional' and can be cleared and saved correctly. And on the show page 'Null' will show correctly. Hope this helps! |
What worked for me is:
|
When a model has a boolean which can be
nil
, the "Show" tab indeed shows the boolean asnil
with the help of a grey icon:However in the Edit tab, the value is displayed as an unticked checkbox instead of reflecting the fact that the value is
nil
:And when saving the Edit form, it then applies the value
false
to the field, instead of keeping itnil
as it should. It means that currently I cannot userails_admin
to edit my records' other fields, out of fear of inadvertently modifying these boolean values which should staynil
.The text was updated successfully, but these errors were encountered: