Add "rentable type" to rentables
[cs356-p2-videostore.git] / app / views / rentable / list.rhtml
index 39883c5..19f6f75 100644 (file)
@@ -2,6 +2,8 @@
 
 <table>
   <tr>
+    <th>ID</th>
+    <th>Title</th>
   <% for column in Rentable.content_columns %>
     <th><%= column.human_name %></th>
   <% end %>
@@ -9,6 +11,16 @@
 
 <% for rentable in @rentables %>
   <tr>
+  <td><%=h rentable.id %></td>
+  <td>
+  <% if Game.find(:first, :conditions => "rentable_id='#{rentable.id}'") %>
+    Game
+  <% elsif Video.find(:first, :conditions => "rentable_id='#{rentable.id}'") %>
+    Video
+  <% else %>
+    ERROR
+  <% end %>
+  </td>
   <% for column in Rentable.content_columns %>
     <td><%=h rentable.send(column.name) %></td>
   <% end %>