Display form errors using custom validity messages

This commit is contained in:
2026-07-28 00:45:08 +02:00
parent 5d051de666
commit eb2797bd90
13 changed files with 81 additions and 51 deletions

View File

@@ -0,0 +1,7 @@
<%= turbo_stream.validate dom_target(*@target, :form) do %>
<% @record.errors.attribute_names.map do |attr| %>
<%= tag.span data: {name: field_name(dom_class(@record), attr)} do %>
<%- @record.errors.full_messages_for(attr).map { |m| m + '.' }.join(' ') %>
<% end %>
<% end %>
<% end %>