title: Choosing a controller and routes for a join table
body: <p>I'm building a favorites feature. </p>
  
  <p>For instance:</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    has_many :favorites
  end
  
  class Product &lt; ActiveRecord::Base
    has_many :favorites
  end
  
  class Favorite &lt; ActiveRecord::Base
    belongs_to :user
    belongs_to :product
  end
  </code></pre>
  
  <p><strong>Scenario</strong></p>
  
  <p>I have a list of products, and I want to add a <code>[+] Add to favorites</code> link next to each product.</p>
  
  <p><strong>My questions</strong></p>
  
  <ul>
  <li>Do I wrap the entire listing in a form tag so I can use POST to <em>some</em> controller -- or do I do something with a link_to_remote tag? </li>
  <li>Do I use the <code>create</code> action of the product controller, or should I use the favorites controller - or even the user controller (because it's the User's favorites)?</li>
  </ul>
  
  <p>As you can see I am unsure of where to put code for a join table. Who "owns" what? I'm afraid of using bad anti patterns.</p>