You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now in the view, we want to show validation errors. Typically, this is something like this:
-# app/views/blogs/_form.html.haml
- if form.errors.any?.alert
%h4
= pluralize(form.errors.count, 'error')
prohibited this blog from being saved:
%ul
- form.errors.each do |key, message|
%li="#{key}#{message}"
Now if we have a validation error on a PostForm, this error will not be displayed, since it's in e.g. form.post.first.errors.
It's not difficult to loop over all the errors of nested models, but if you have many nested forms this becomes tedious. Do you think it would be nice to be able to do something like form.all_errors?
The text was updated successfully, but these errors were encountered:
Thanks for the question! Sorry for the delayed response but I've been away on vacation recently. Let me digest this a little and I'll get back to you. Thanks for your patience.
Hi @andypike,
First off: thanks a lot for your work on Rectify!
So I've been rectifying a rather big, complex form and been running into some questions.
One of those is: how do you display errors on nested forms?
Take for instance the blog example again:
Now in the view, we want to show validation errors. Typically, this is something like this:
Now if we have a validation error on a
PostForm
, this error will not be displayed, since it's in e.g.form.post.first.errors
.It's not difficult to loop over all the errors of nested models, but if you have many nested forms this becomes tedious.
Do you think it would be nice to be able to do something like
form.all_errors
?The text was updated successfully, but these errors were encountered: