Skip to content
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

Run validations when type check failed #424

Open
antulik opened this issue Sep 14, 2017 · 3 comments
Open

Run validations when type check failed #424

antulik opened this issue Sep 14, 2017 · 3 comments
Assignees

Comments

@antulik
Copy link
Contributor

antulik commented Sep 14, 2017

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?

@tfausak
Copy link
Collaborator

tfausak commented Sep 14, 2017

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

@AaronLasseigne
Copy link
Owner

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.

@AaronLasseigne AaronLasseigne self-assigned this Jan 18, 2018
@hurrycaner
Copy link

As workaround it is possible to use everything as interface to skip type validation, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants