I have a form where I have added some validation, I would like the errors to be listed, I have an idea that it can be done this way.
= simple_form_for(@post) do |f|
.row.pt-4
.col-lg-3
-if f.object.errors[:base].present?
.alert.alert-danger
%ul
%li= f.error_notification message: f.object.errors[:base].to_sentence
The problem I have is that the first error is listing it correctly, but the others are not.
it should be displayed every error with a bullet point
You need to loop over the errors:
= simple_form_for(@post) do |f|
.row.pt-4
.col-lg-3
-if f.object.errors.any?
.alert.alert-danger
%ul
= f.object.errors.each do |error|
%li= f.error_notification message: error.message