rails/rails — pull request #15728 by sgrif (2014-06-14 15:22:03+00:00)
Title: Don't save through records twice

If the through record gets created in an `after_create` hook that is
defined before the association is defined (therefore after its
`after_create` hook) get saved twice. This ensures that the through
records are created only once, regardless of the order of the hooks.

Fixes #3798