<%= form_for task do |f| %>
  <%= render partial: 'application/form_errors', locals: {object: task} %>
  <div class="form-group">
    <%= f.label :name %>
    <%= f.text_field :name, class: 'form-control' %>
  </div>
  <div class="form-group">
    <%= f.label :description %>
    <%= f.text_area :description, class: 'form-control' %>
  </div>
  <div class="form-group">
    <%= f.label :complete_by %>
    <%= f.date_field :complete_by, class: 'form-control' %>
  </div>
  <div class="form-group">
    <%= f.check_box :completed%>
    <%= f.label :completed%>
  </div>
  <div class="form-group">
    <%= f.label :projects, "Select one or more projects to add this task to" %>
    <ul class="list-group">
      <%= f.collection_check_boxes :project_ids, current_user.projects, :id, :name do |b| %>
        <%= b.label(class: "list-group-item") do %>
          <%= b.check_box %>
          <%= b.text %>
        <% end %>
      <% end %>
    </ul>
  </div>
  <%= f.submit class: 'btn btn-primary'%>
<% end %>

<% if current_user.projects.count < 1 %>
  <div class="alert alert-warning" role="alert">
    You must have at least one project to create a task. Click
    <%= link_to "here", new_project_path, class: 'alert-link' %> to create a project.
  </div>
<% end %>
<%= form_for task do |f| %>
  <%= render partial: 'application/form_errors', locals: {object: task} %>
  <div class="form-group">
    <%= f.label :name %>
    <%= f.text_field :name, class: 'form-control' %>
  </div>
  <div class="form-group">
    <%= f.label :description %>
    <%= f.text_area :description, class: 'form-control' %>
  </div>
  <div class="form-group">
    <%= f.label :complete_by %>
    <%= f.date_field :complete_by, class: 'form-control' %>
  </div>
  <div class="form-group">
    <%= f.check_box :completed%>
    <%= f.label :completed%>
  </div>
  <div class="form-group">
    <%= f.label :projects, "Select one or more projects to add this task to" %>
    <ul class="list-group">
      <%= f.collection_check_boxes :project_ids, current_user.projects, :id, :name do |b| %>
        <%= b.label(class: "list-group-item") do %>
          <%= b.check_box %>
          <%= b.text %>
        <% end %>
      <% end %>
    </ul>
  </div>
  <%= f.submit class: 'btn btn-primary'%>
<% end %>

Add warning to new task page when the user doesnt have any projects
Add warning to new task page when the user doesnt have any projects
