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

Make strict coercion rule configurable #6

Open
fredwu opened this issue Jun 26, 2013 · 3 comments
Open

Make strict coercion rule configurable #6

fredwu opened this issue Jun 26, 2013 · 3 comments
Labels
Milestone

Comments

@fredwu
Copy link

fredwu commented Jun 26, 2013

After upgrading to Virtus 1.0 which depends on Coercible 0.2.0, we noticed that a bunch of our attributes are now failing due to the stricter coercion rule. For example, a Date field can no longer accept "" (an empty string) because it cannot be coerced. This is especially troublesome in a rails project where attributes can be optional (so they get submitted as empty strings).

Could we make raising UnsupportedCoercion configurable?

For now I have to monkey patch raise_unsupported_coercion to return value directly to get back 0.1.0's behaviour.

Thanks!

@solnic
Copy link
Owner

solnic commented Jun 26, 2013

Yes this feature is planned for virtus/coercible 1.0.0

@fredwu
Copy link
Author

fredwu commented Jun 26, 2013

Awesome! 👍

@shepmaster
Copy link

👍 This would indeed be useful for the reasons stated by @fredwu.

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

3 participants