= form_for @<%= resource_name %>, html: {class: 'form-horizontal' } do |f|
  = render 'error_messages', target: @<%= resource_name %>
  <%- columns.each do |column| -%>
  .control-group class=(@<%= resource_name %>.errors[:<%= column.name %>].any? ? 'error' : nil)
    = f.label :<%= column.name %>, class: 'control-label'
    .controls
      = f.<%= column.field_type %> :<%= column.name %>, class: '<%= column.field_type %>'
  <%- end -%>
  <%- belongs_to_associations.each do |association| -%>
  .control-group class=(@<%= resource_name %>.errors[:<%= association.name %>_id].any? ? 'error' : nil)
    = f.label :<%= association.name %>_id, <%= association.options[:class_name] %>.model_name.human, class: 'control-label'
    .controls
      = f.collection_select :<%= association.name %>_id, @<%= association.name.to_s.pluralize %>, :id, :<%= association.name_property%>, include_blank: <%= model_name.constantize.validators_on(:"#{association.name}_id").any? ? 'nil' : "''" %>
  <%- end -%>
  .form-actions
    = f.submit nil, class: 'btn btn-primary'
    '
    = link_to t("helpers.links.cancel"), <%= controller_routing_path %>_path, class: 'btn'
