-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Validators should return their success or failure #624
Comments
I like that idea, though, not too sure about raising an exception. The actual error handling shouldn't be done in operations. That should be handled outside which is most likely the Action so that way the ErrorHandler picks it all up. The only main thing to consider is if you have an attribute that is allowed to be nil, but you pass it to |
What I want to do with the UI is something like this:
|
I am dubious about validators ignoring conditions that aren't true. Consider that validators with
|
Validators currently don't return a defined value. They should return
true
for valid andfalse
for invalid. That way, we could run validators conditionally depending on the success of others. For example:It would then also be possible to change
validate_size_of
, etc. to raise an exception if they are called upon a nil value, rather than silently ignoring it, which just seems wrong for validators.The text was updated successfully, but these errors were encountered: