Fix object relational modeling
[cs356-p2-videostore.git] / app / views / coitem / list.rhtml
1 <h1>Listing coitems</h1>
2
3 <table>
4   <tr>
5   <th>Customer</th>
6   <th>Rentable</th>
7   <% for column in Coitem.content_columns %>
8     <th><%= column.human_name %></th>
9   <% end %>
10   </tr>
11   
12 <% for coitem in @coitems %>
13   <tr>
14   <td><%=h coitem.customer.name %></td>
15   <td><%=h coitem.rentable.title %></td>
16   <% for column in Coitem.content_columns %>
17     <td><%=h coitem.send(column.name) %></td>
18   <% end %>
19     <td><%= link_to 'Show', :action => 'show', :id => coitem %></td>
20     <td><%= link_to 'Edit', :action => 'edit', :id => coitem %></td>
21     <td><%= link_to 'Destroy', { :action => 'destroy', :id => coitem }, :confirm => 'Are you sure?', :method => :post %></td>
22   </tr>
23 <% end %>
24 </table>
25
26 <%= link_to 'Previous page', { :page => @coitem_pages.current.previous } if @coitem_pages.current.previous %>
27 <%= link_to 'Next page', { :page => @coitem_pages.current.next } if @coitem_pages.current.next %> 
28
29 <br />
30
31 <%= link_to 'New coitem', :action => 'new' %>