Test case for valid_assignment?

ref #878

When the `valid?` method is being called, the AR object loses track of the parent AR.

I wrote a test which reproduce the behavior.