Skip to content

Commit 5dbfea3

Browse files
Small stuff
1 parent 97e3e8b commit 5dbfea3

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

test/dummy/app/controllers/forms/previews_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def create
1414
if @instance.valid?
1515
render :create
1616
else
17-
render :show
17+
render :show, status: :unprocessable_entity
1818
end
1919
end
2020

test/dummy/app/views/_form_core/fields/_date.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="form-group row">
22
<%= f.label field.key, field.name, class: 'col-sm-2 col-form-label' %>
33
<div class="col-sm-10">
4-
<%= f.date_field field.key, field.field_options.merge(class: 'form-control', id: field.id, required: field.required, disabled: field.disabled?, class_for_error: "is-invalid") %>
4+
<%= f.date_field field.key, options: field.field_options.merge(class: 'form-control', id: field.id, required: field.required, disabled: field.disabled?, class_for_error: "is-invalid") %>
55
<%= f.error_message field.key, class: "invalid-feedback" %>
66
<% if field.hint.present? %>
77
<span class="form-text text-muted">

test/dummy/app/views/forms/previews/show.html.erb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22
<%= render "forms/tabs" %>
33
</div>
44

5+
<% if @instance.errors.any? %>
6+
<div id="error_explanation" class="errors">
7+
<h2><%= pluralize(@instance.errors.count, "error") %> prohibited this form from being saved:</h2>
8+
<ul>
9+
<% @instance.errors.full_messages.each do |message| %>
10+
<li><%= message %></li>
11+
<% end %>
12+
</ul>
13+
</div>
14+
<% end %>
15+
516
<div class="container">
617
<%= render "_form_core/render/form",
718
form: @form, instance: @instance,

0 commit comments

Comments
 (0)