active_interaction
active_interaction copied to clipboard
Run validations when type check failed
Not a big issue, but could be annoying
For example let's assume we have a active_interaction object used as a form object.
class SomeForm < ActiveInteraction::Base
integer :value
string :comment
validates_presence_of :comment
def execute
end
end
Currently
When user enters incorrect number, he gets an error for value
but no error for comment
. Once the value
error is fixed user submits the form and now gets error on comment
. Which looks strange as on the previous submit there were no errors for comment
.
How it should be In this use case we need to present all errors at once, including type and validation errors.
Currently don't know any work around for it. And would be nice to have such feature by default. Thoughts?
See #354, #300, and #223. This is the expected behavior:
When you run this interaction, two things will happen. First ActiveInteraction will type check your inputs. Then ActiveModel will validate them. If both of those are happy, it will be executed.
https://github.com/orgsync/active_interaction/tree/v3.5.2#validations
This has come up several times which means it might be worth revisiting. I'm already doing a major error overhaul in v4.0.0.
As workaround it is possible to use everything as interface to skip type validation, right?