= simple_form_for(@<%= singular_table_name %>) do |f|
  = f.error_notification

<%- attributes.each do |attribute| -%>
  = f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %>
<%- end -%>

  = f.button :submit, :class => 'btn btn-primary'

  - if @<%= singular_table_name %>.persisted?
    = link_to 'Cancel', @<%= singular_table_name %>, :class => 'btn btn-default'
  - else
    = link_to 'Cancel', <%= index_helper %>_path, :class => 'btn btn-default'


= simple_form_for(@<%= singular_table_name %>) do |f|
  = f.error_notification

<%- attributes.each do |attribute| -%>
  = f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %>
<%- end -%>

  = f.button :submit, :class => 'btn btn-primary'

  - if @<%= singular_table_name %>.persisted?
    = link_to 'Cancel', @<%= singular_table_name %>, :class => 'btn btn-default'
  - else
    = link_to 'Cancel', <%= index_helper %>_path, :class => 'btn btn-default'

  - if @<%= singular_table_name %>.persisted?
    = link_to @<%= singular_table_name %>,
        :class => 'btn btn-danger pull-right',
        :method => :delete,
        :data => { :confirm => 'Are you sure?' } do
      %i.glyphicon.glyphicon-trash
      = "Destroy #{<%= class_name %>.model_name.human}"

Add destroy button on scaffold form for persisted records
Add destroy button on scaffold form for persisted records
