rails/rails — pull request #8549 by iamvery (2012-12-18 16:44:22+00:00)
Title: Derived Inverses: A Start

This is my attempt to start the implementation of automatically derived inverse associations. I was heavily inspired this [this](https://github.com/rails/rails/issues/6161#issuecomment-7238602) comment. As it turns out, the problem seems to be quite difficult to solve.

6722292 and 904dc21 are essentially the automatic inverse implementation. The other 3 commits are attempting to fix failing tests out of the automatic derivation of inverses.

I've struggled for several days to figure out all the interesting problems that this implementation has presented, but finally I'm choosing to submit it to the community so that we can come to the right solution together!

The primary issue seems to be how to identify when inverses are not appropriate. Its easy to guess what the inverse might be, but its apparent to me now that there are a lot of places they just shouldn't or can't exist. So assuming there will be an inverse can lead to bad things :). I ran into a lot of issues like #7250 #653 #7809, etc.

I'm sorry to deliver known failing commits, but perhaps this can spur process of developing this feature to completion!