mongoid/mongoid — Issue #1358: HABTM :inverse_of => nil broken in 2.3.2
Author: bensymonds
Created: 2011-10-19 13:28:45+00:00
State: open

```
class Movie
include Mongoid::Document
has_and_belongs_to_many :ratings, :inverse_of => nil
end

class Rating
include Mongoid::Document
end

Movie.new :ratings => [Rating.new]
=> TypeError: keys must be strings or symbols
```

Mongoid is correctly determining there is no inverse foreign key field (so is nil), but still tries to do the update to the Rating anyway (i.e. tries to do something like ```update(nil => movie._id)```, hence the ```TypeError```.