form_for @<%= singular_table_name %>, html: { class: 'form-horizontal', role: “form” } do |f|

-if @<%= singular_table_name %>.errors.any?
  .alert.alert-danger.alert-dismissable{role: "alert"}
    %button.close{type: "button", data: {dismiss: "alert"} }
      %span{aria: {hidden: "true"} } &times;
      %span.sr-only Close
    %h4= "#{pluralize(@<%= singular_table_name %>.errors.count, "error")} prohibited this <%= singular_table_name %> from being saved:"

    %ul
      - @<%= singular_table_name %>.errors.full_messages.each do |msg|
        %li= msg

<% for attribute in attributes -%>

.form-group
  = f.label :<%= attribute.name %>, class: 'col-sm-2 control-label'
  .col-sm-10
    <% if attribute.type == :references %>
    = f.collection_select :<%= attribute.name %>_id, <%= attribute.name.camelize %>.all, :id, :name, { prompt: true }, { class: 'form-control' }
    <% else %>
    = f.<%= attribute.field_type %> :<%= attribute.name %>, class: 'form-control'
    <% end %>

<% end -%>

.form-group
  .col-sm-offset-2.col-sm-10
    = f.submit class: 'btn btn-primary', value: t( '.submit' ), 'data-disable-with' => t( '.submit' )