- targets = Array(target).select { |ele| ele.errors.any? } - if targets.any? #error_explanation div [ class="alert customize-alert alert-dismissible alert-light-danger text-danger fade show" role="alert" ] button.btn-close aria-label="Close" data-bs-dismiss="alert" type="button" - targets.map(&:errors).map(&:messages).map(&:values).flatten.each do |message| | #{message}