If you attempt the create a has_many :through association that uses a has_many association with nonstandard primary and foreign keys, you will get an infinite loop when trying to use the association. I have written a longer description of this problem, along with a simple, tested patch that fixes it in the following bug:
Aubrey