<%= form_for record, html: { class: 'form form-horizontal' } do |f| %>
  <fieldset id="<%= header_text.parameterize %>">
    <h3 class="fieldset-heading"><%= header_text %></h3>

      <%= f.fields_for nested_model_class.to_s.parameterize.to_sym do |nested_f| %>

        <% names.each do |name| %>
          <div class="form-group">
            <label class="control">
              <%= nested_model_class.fields[name].display_name unless name.nil? %>
            </label>

            <div class="control">
              <%= nested_model_class.fields[name].generate_field nested_f, record %>
            </div>
          </div>
        <% end %>

      <% end %>
      

      <div class="form-group">
        <div class="form-submit">
          <%= f.submit 'Save', class: 'btn btn-primary' %>
        </div>
      </div>

  </fieldset>
<% end %>