Changed the guides for associations, warning about race conditions when checking for distinctness

I change the rails guides to use ``distinct`` instead of ``uniq`` because that's the new naming convention (see commit https://github.com/rails/rails/commit/a1bb6c8b06db83546179175b9b2dde7912c86f9b). 

I've also provided an example of how distinctness when inserting into an association can be
achieved. I'm making a PR instead of using doc rails because I'm not sure if this is the best place to put this comment, or whether it is better put in some other part of the docs (or maybe if it isn't relevant at all and should be left out).