<h1><%= @movie.title %>'s actors</h1>
<!-- THIS VIEW IS NOT TIED TO A PARTICULAR MODEL. IT CONTAINS 
     TWO FORMS AND INTENDS TO ALLOW CONNECTING ACTORS WITH 
     MOVIES. YOU CAN ADD OR A REMOVE ACTOR(S) FROM MOVIES AND 
     VIEW THE RELATIONSHIP BETWEEN THOSE ENTITIES ON ONE SCREN. 
     IT WILL ALSO ANNOUNCE EXTREMES, LIKE MOVIES WITH NO ACTORS
     ETC.  
-->
<% if @actors.length > 0 %>
  <% form_tag(actor_remove_movie_path(@movie)) do %>
  <table>
    <tr>
      <th>Actor / Actress</th>
      <th>Remove?</th>
    </tr>
  <% for actor in @actors do %>
      <tr>
        <td><%=h actor.full_name %></td>
        <td><%= check_box_tag "actors[]", actor.id %></td>
      </tr>
  <% end %>
  </table>
  <br />

  <%= submit_tag "Remove checked actors" %>
  <% end %>
<% else %>
<p>Do not have any actor from our collection yet.</p>
<% end %>

<h3> Add one of our actors </h3>

<% if @movie.actors.count < Actor.count then %>
  <% form_tag(actor_add_movie_path(@movie)) do %>
    <%= select_tag(:actor,
      options_from_collection_for_select(@movie.actors_not_in,
        :id, 'full_name')) %>
    <%= submit_tag 'Add' %>
  <% end %>
<% else %>
  <p><%=h @movie.title %>  
	either has all the actors in our collection already, 
	or our collection of actors is still empty.</p>
<% end %>

<p><%=link_to "Back", @movie %></p>