From 27f103fc7e3260efe0b8dde66bf5354f2202ee32 Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Sun, 26 Mar 2017 11:42:39 +0200 Subject: add field ids when generating a scaffold form. This is a follow up to a6d065e. When using `form_with` you must supply field ids manually. Since the scaffold generator is using labels we need to make sure that they are linked up properly. --- railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb') diff --git a/railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb b/railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb index 73c00ad41a..4f2e84f924 100644 --- a/railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb +++ b/railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb @@ -15,15 +15,15 @@
<% if attribute.password_digest? -%> <%%= form.label :password %> - <%%= form.password_field :password %> + <%%= form.password_field :password, id: :<%= field_id(:password) %> %>
<%%= form.label :password_confirmation %> - <%%= form.password_field :password_confirmation %> + <%%= form.password_field :password_confirmation, id: :<%= field_id(:password_confirmation) %> %> <% else -%> <%%= form.label :<%= attribute.column_name %> %> - <%%= form.<%= attribute.field_type %> :<%= attribute.column_name %> %> + <%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, id: :<%= field_id(attribute.column_name) %> %> <% end -%>
-- cgit v1.2.3