title: has_and_belongs_to_many and unique index on association table generates "Duplicate entry" fail
body: <p>I have several <code>has_and_belongs_to_many</code> associations and I also used the <code>uniq</code> option in associations to avoid MySQL errors in relation with duplicate keys. My associations are like this:</p>
  
  <pre><code>has_and_belongs_to_many :people, :uniq =&gt; true
  </code></pre>
  
  <p>The index I added is a divided primary key I added using:</p>
  
  <pre><code>add_index :table_name, [:key_1, :key_2], :unique =&gt; true
  </code></pre>
  
  <p>on both sides of the assocation. But when I try to associate an object twice my application throws the <code>Mysql2::Error: Duplicate entry '1-9' for key...</code> error which is generated by MySQL. Is there a smart way to handle this problem?</p>
  
  <p>I have thought about several possible solutions but the arent smart. I thought about changing the INSERT query manually by using the <code>:insert_sql</code> option but that would be a lot of work dong this for 20 association tables. Is there a better way to deal with this?</p>