changes
This commit is contained in:
23
lib/templates/erb/scaffold/_form.html.erb
Normal file
23
lib/templates/erb/scaffold/_form.html.erb
Normal file
@@ -0,0 +1,23 @@
|
||||
<%%= simple_form_for(@<%= singular_name %>) do |f| %>
|
||||
<%% if @<%= singular_name %>.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<h2><%%= pluralize(@<%= singular_name %>.errors.count, "error") %> prohibited this <%= singular_name %> from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<%% @<%= singular_name %>.errors.full_messages.each do |msg| %>
|
||||
<li><%%= msg %></li>
|
||||
<%% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<%% end %>
|
||||
|
||||
<div class="inputs">
|
||||
<%- attributes.each do |attribute| -%>
|
||||
<%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %>
|
||||
<%- end -%>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%%= f.button :submit %>
|
||||
</div>
|
||||
<%% end %>
|
||||
Reference in New Issue
Block a user