rails/rails — pull request #15579 by sgrif (2014-06-08 22:07:47+00:00)
Title: Through associations should set both parent ids on join models

member = Member.new(club: Club.new)
member.save!

Before:

member.current_membership.club_id # => nil

After:

member.current_membership.club_id # => club's id