Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 1st, 2012  |  syntax: None  |  size: 0.43 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Partials for HABTM
  2. has_and_belongs_to_many :comps
  3.        
  4. has_and_belongs_to_many :users
  5.        
  6. def index
  7.     @user = User.find(current_user.id)    
  8.     @comps = @user.comps
  9.   end
  10.        
  11. <%= render @comps %>
  12.        
  13. <tr>
  14. <span class="content"><%= comp.name %></span>
  15.   <td>
  16.   <%= link_to "delete", comp, :method => :delete,
  17.                               :confirm => "You sure?",
  18.                               :title => comp.name %>
  19.   </td>
  20. </tr>