-
-
Notifications
You must be signed in to change notification settings - Fork 913
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
validate_presence_of fails for Shrine UploadedFile since empty string was introduced #1228
Comments
Thanks for the report! I have a branch in the works that should fix this issue, but I'll leave this open in the meantime. |
the same problem with serializable fields, like got an exception:
|
I'm running into similar problems with attributes (or rather methods) that get validated but are not handling strings but objects. In theory I could make all setters handle empty strings, but it feels like the wrong path. |
@klaustopher @vitalinfo @benedikt Hey, I just pushed up a branch, |
@mcmire Yes, that works. Thanks a lot for your efforts, Elliot! |
Tested revision 11f4483 and it works fine with Shrine. |
Fixed in v4.1.1. |
This somehow relates to #1223 and #1218, but I think it is also different. Please feel free to close and merge with one of the open issues.
Currently our update to
4.1.0
is blocked because on of our test cases is failing with the new version.The model is super simple:
I have played around a bit and the shrine uploader simply ignores assigning
""
to the image attribute:Checking all the conditions:
Shrine seems to use an unspecified
ActiveModel::Type
class.For now, we have added a few custom tests instead of
validate_presence_of
for the field, but maybe it's possible to make theempty string check
optional with a modifier?The text was updated successfully, but these errors were encountered: