Implement #take and #take! on associations such as has_many

#take on a has_many that happened to be loaded was raising a nil dereference error.  This patch fixes that, and adds spec coverage.

This commit is on 4-1-stable, it also cleanly applies to master.
```ruby
set_inverse_instance(record) if record.is_a?(ActiveRecord::Base)
```