-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
When overwriting a HABTM relation twice with the same value, the inverse foreign key ends up being empty:
class A include Mongoid::Document has_and_belongs_to_many :bs, inverse_of: :as end class B include Mongoid::Document has_and_belongs_to_many :as, inverse_of: :bs end a = A.create b = B.create a.bs = [b] puts a.reload.b_ids.inspect # => [id] puts b.reload.a_ids.inspect # => [id] a.bs = [b] puts a.reload.b_ids.inspect # => [id] puts b.reload.a_ids.inspect # => []
Please see attached pull request for a corresponding failing spec. The commit also applies cleanly to master and the spec fails there as well.