rails/rails — Issue #3425: has_many :through behaves as if :uniq => true was set even when its not
Author: hukl
Created: 2011-10-24 18:59:08+00:00
State: open

When I add the same object multiple times to a has_many :through collection, only one of those objects is actually committed instead of all three as if :uniq => true was set. I tested this with mysql, mysql2 and sqlite3 file and memory db so it seems to be rails related.

I've created a proper test script to reproduce this: https://gist.github.com/1309797

This worked through all of rails 3.0.x but not in any 3.1.x including the beta1.

You have tests for this which pass but I suspect that fixtures or the fact that the tests run within transactions which are not committed prevent this bug from occurring.