-
Notifications
You must be signed in to change notification settings - Fork 64
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
saving nilable item with form #27
Comments
I'm also having this issue and the suggest fix does work. @paulcsmith Are you okay with this fix? I can make a PR. |
@snadon I think the problem with this approach is that if you want an Int32? and pass it
I think what we'd want to do is somehow change the |
Okay, so rapidly, if we cast Nil whenever an Int32 as a value of "":
and to make it compile, we need to add
This fixes my problem but I cannot run the tests at the moment. I would need to install docker on my laptop. Do you think there are repercussions? If by any chance this is good, I can make a PR (including changes for Float64 and Int64). |
I think the change should be made in Avram::Type so that all object types get this behavior. Also adding the If you wanna dive in more that is great, but if not I'll take a look later |
Thank you @paulcsmith for your great help on this issue. I'm dropping this here for anybody who needs a workaround:
And use it like this:
|
I believe this is fixed in master with the latest changes from #381. |
when save empty field it raises error
Should allow save nilable values in database
needed change in src/lucky_record/form.cr:
to this:
or cast emty string as nil
The text was updated successfully, but these errors were encountered: