<h1>New trip</h1>

<%= render 'form' %>

<%= link_to 'Back', trips_path %>

<h1>New trip</h1>

<%= form_for(@trip) do |f| %>
  <div class="field">
    <%= f.label :name %><br>
    <%= f.text_field :name %>
  </div>
  <div class="field">
    <%= f.label :description %><br>
    <%= f.text_area :description %>
  </div>
  <div class="field">
    <%= f.label :budget %><br>
    <%= f.number_field :budget %>
  </div>

<div id="legs">
  <%= f.fields_for :legs do |legs_form| %>
    <div class="field">
      <%= legs_form.label :location_id %><br>
      <%= legs_form.text_field :location_id %>
    </div>
    <div class="field">
      <%= legs_form.label :start_date %><br>
      <%= legs_form.date_select :start_date %>
    </div>
    <div class="field">
      <%= legs_form.label :end_date %><br>
      <%= legs_form.date_select :end_date %>
    </div>
  <% end %>
</div>

  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>

<%= link_to 'Back', trips_path %>

Add form for leg to new trip view
Add form for leg to new trip view
