Skip to content
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

allow_nil option transforms nil values when should not #35

Open
javierseixas opened this issue Dec 17, 2019 · 1 comment
Open

allow_nil option transforms nil values when should not #35

javierseixas opened this issue Dec 17, 2019 · 1 comment
Labels

Comments

@javierseixas
Copy link

Hi!

With #27 and its release in v0.9.5 a bug was introduced: nil values are converted to 0, 0.0 or '' if allow_nil is not allowed.

I think that the behavior should be that a nil should be allowed if option is enabled, but if not, the value should remain.

So, in the Integer case, I would suggest:

case value
when nil then options[:allow_nil] ? nil : value
...
@davydovanton
Copy link
Owner

hey, sorry for the long delay. Thanks for the report!

I think it will be a good idea to fix it. Do you want to prepare PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants