-
Notifications
You must be signed in to change notification settings - Fork 109
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
Monkeypatch of Virtus for empty arrays to be coerced to nil causes unintended consequences #136
Comments
@forest The other option is to use Ruby refinements which would limit the scope of the monkeypatch. I will play with it and see if that can work. |
OK it looks like that loading behavior is not behaving as expected because the patch is being loaded before Changing the patch file does result in a failed test
|
@amalagaura I'm happy to take your recommendation and fix for this. I'm no longer actively using this gem and so don't have the time to dig deep on these kinds of issues. I'm happy to continue to support the community of users though. |
There was a similar issue with #113 which was fixed by patching the monkeypatch. But we are using a gem which expects empty arrays to stay as empty arrays.
The discussion here: 27599e7#r16125838 suggests that the required coercion is different from what Virtus does.
My suggestion is to create the
NullifyEmpty
class as suggested and move TrackerAPI specific behavior into it. Otherwise TrackerAPI is conflicting with other gems.The behavior needed is a Custom Coersion which would be added to the Shared::Base
The text was updated successfully, but these errors were encountered: