diff options
author | Yves Senn <yves.senn@gmail.com> | 2017-03-26 11:42:39 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2017-03-26 12:11:45 +0200 |
commit | 27f103fc7e3260efe0b8dde66bf5354f2202ee32 (patch) | |
tree | ef196c56123ccb0859830c39b74b6458250d0bcf /railties/lib/rails/generators/erb/scaffold | |
parent | d96dde82b7ff3a216c16eb87e2d346341ad53c05 (diff) | |
download | rails-27f103fc7e3260efe0b8dde66bf5354f2202ee32.tar.gz rails-27f103fc7e3260efe0b8dde66bf5354f2202ee32.tar.bz2 rails-27f103fc7e3260efe0b8dde66bf5354f2202ee32.zip |
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.
Diffstat (limited to 'railties/lib/rails/generators/erb/scaffold')
-rw-r--r-- | railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb | 6 |
1 files changed, 3 insertions, 3 deletions
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 @@ <div class="field"> <% if attribute.password_digest? -%> <%%= form.label :password %> - <%%= form.password_field :password %> + <%%= form.password_field :password, id: :<%= field_id(:password) %> %> </div> <div class="field"> <%%= 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 -%> </div> |