diff options
author | Aidan Haran <aidanharan@yahoo.com> | 2017-12-09 13:41:02 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-09 13:41:02 +0000 |
commit | 66f34a8ea58c8c98d9cc2651d386c9e5a0789d08 (patch) | |
tree | d24e9014cf9045abc892ba97ac993e2e26e31c7e /railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt | |
parent | 3291fa3630c456450f8c6a9b771f77c293d036cd (diff) | |
parent | 55d4cf2a9c1a6e77ed7aedb866e964039bb4a143 (diff) | |
download | rails-66f34a8ea58c8c98d9cc2651d386c9e5a0789d08.tar.gz rails-66f34a8ea58c8c98d9cc2651d386c9e5a0789d08.tar.bz2 rails-66f34a8ea58c8c98d9cc2651d386c9e5a0789d08.zip |
Merge branch 'master' into custom-discarded-job-handling
Diffstat (limited to 'railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt')
-rw-r--r-- | railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt b/railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt new file mode 100644 index 0000000000..518cb1121e --- /dev/null +++ b/railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt @@ -0,0 +1,34 @@ +<%%= form_with(model: <%= model_resource_name %>, local: true) do |form| %> + <%% if <%= singular_table_name %>.errors.any? %> + <div id="error_explanation"> + <h2><%%= pluralize(<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</h2> + + <ul> + <%% <%= singular_table_name %>.errors.full_messages.each do |message| %> + <li><%%= message %></li> + <%% end %> + </ul> + </div> + <%% end %> + +<% attributes.each do |attribute| -%> + <div class="field"> +<% if attribute.password_digest? -%> + <%%= form.label :password %> + <%%= form.password_field :password %> + </div> + + <div class="field"> + <%%= form.label :password_confirmation %> + <%%= form.password_field :password_confirmation %> +<% else -%> + <%%= form.label :<%= attribute.column_name %> %> + <%%= form.<%= attribute.field_type %> :<%= attribute.column_name %> %> +<% end -%> + </div> + +<% end -%> + <div class="actions"> + <%%= form.submit %> + </div> +<%% end %> |