Replies: 2 comments 18 replies
-
|
My recommendation as a long time Mongoid user is to stay on Mongoid 7.x. |
Beta Was this translation helpful? Give feedback.
18 replies
-
|
By the way, this is an error that I pointed out a long time ago that we need to do a better way of type casting. We cannot simply type cast String "foo" to Integer nil or 0 and allow a silent failure to happen; it needs to either raise an error or fail the validation step. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm upgrading Rails app from mongoid 7.5 to 8.1.1. I had validations like:
When using 7.5 and I pass e.g. string 'foo' validation does not pass as expected. But in mongoid 8.1.1 as I'v found when passing string and it's not a number it's casted to number, if cast can not be done it's silently converted to nil. So now my validation passes when it should not. I'v refactored it that way:
It works as expected now but I want to make sure are there any drawbacks/dangers in that approach?
Beta Was this translation helpful? Give feedback.
All reactions