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

test: validate relationships after action changes #238

Closed

Conversation

rapidfsub
Copy link
Contributor

Didn't fix the bug.
I just wrote a simple failing test.

In create_with_default_comment action, I am setting default value of comment text attribute.
However, because of the order of validations, this form cannot be submitted.

@zachdaniel
Copy link
Contributor

The fix for this is complex. The way that forms provide intelligent errors up front is by "pre-validating" the inputs. If you want to handle that error you're going to need to add an error_handler, or when submitting use force?: true to force submission even though a child form is invalid.

@zachdaniel zachdaniel closed this Sep 10, 2024
@rapidfsub
Copy link
Contributor Author

generated?: true option can be a workaround for this? @zachdaniel

@zachdaniel
Copy link
Contributor

On the destination action (of the related resource), you could add allow_nil_input [:the, :action], would potentially be one way to solve it.

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

Successfully merging this pull request may close these issues.

2 participants