<h1>Reviews for: <%=h @movie.title %></h1>

<% if @movie.reviews.count > 0 %>
<table>
  <tr>
    <th>Reviewer name</th>
    <th>Organization</th>
    <th>Review date</th>
    <th>Review text</th>
  </tr>

<% @reviews.each do |review| %>
  <tr>
    <td><%=h review.reviewer_name %></td>
    <td><%=h review.organization %></td>
    <td><%=h review.review_date %></td>
    <td><%=h review.review_text %></td>
    <td><%= link_to 'Show', [@movie, review] %></td>
    <td><%= link_to 'Edit', edit_movie_review_path(@movie, review) %></td>
    <td><%= link_to 'Destroy', [@movie, review], :confirm => 'Are you sure?', 
    :method => :delete %></td>
  </tr>
<% end %>
</table>

<br />
<% else %>
    <p><%=h @movie.title %> does not yet have any reviews. </p>
<% end %>
<p>
<%= link_to 'New review', new_movie_review_path(@movie) %> |
<%= link_to 'Back to movie', @movie %>
</p>