Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-2030

delete from a HABTM relationship does not nullify the inverse relationship

      I have the following:

      class User
        has_and_belongs_to_many :followers, class_name: 'User', inverse_of: :following
        has_and_belongs_to_many :following, class_name: 'User', inverse_of: :followers
      end
      

      when I do user.following.delete(following_user) I expect that the id is removed from both user.following_ids and following_user.follower_ids.

      What I'm seeing is the id still remains in following_user.follower_ids. That is, it's removing the reference correctly from following, but not doing it likewise on followers.

      From what I understand from the docs, calling delete should orphan the child, and with nullify as the default dependent behaviour on the inverse side, it should do likewise to that too.

      Is this a bug or am I missing something?
      Using mongoid 2.4.9 and ruby 1.9.3.

            Assignee:
            Unassigned Unassigned
            Reporter:
            stantona stantona
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: