Assigning nil to a polymorphic belongs_to should nullify its _type column

Fixes failing test added at c141dfc838a5dca9f197814410fa5d44c143129c ,
caused by regression introduced at 1678e959e973de32287b65c52ebc6cce87148951