Patch for has_one :through associations

I have opened a ticket for a small patch that fixes two small errors in has_one :through associations:

1) An unassigned has_one :through association should return nil when referenced. Instead, it returns an empty array. This is due to the call to #reset_target! on AssociationCollection, which is the most derived class that defines that method in the inheritance hierarchy for HasOneThroughAssociation.

2) Assigning to a has_one :through association does not correctly assign to the target of the association. This is due to the way the target gets set in the attribute writer method. The attribute writer creates the join association, then delegates to the attribute reader, with an explicit reload, to recreate the has_one :through association and save it on the instance. However, after calling the attribute reader, the attribute writer overwrites the instance variable with an out of date association object.

The patch includes tests for each of these behaviors, along with the fixes.

http://rails.lighthouseapp.com/projects/8994/tickets/895-has_one-through-errors