HABTM with foreign_key & primary_key set does not create reverse association

XMLWordPrintableJSON

    • None
    • None
    • None
    • None
    • None
    • None

      Failing test case:

            animal = ForeignKeySpec::Animal.create!(a: 'bear')
            zoo = ForeignKeySpec::Zoo.create!(z: 'bz')
            animal.zoos << zoo
            animal.save!
      
            # This write should not be necessary, but without it the test fails.
            zoo.animals << animal
            zoo.save!
      
            expect(zoo.animals).to eq([animal])
            zoo = ForeignKeySpec::Zoo.find(zoo.id)
            expect(zoo.animals).to eq([animal])
      

      Due to this bug 4642 does not document specifying PK/FK with HABTM, since the combo appears to not work.

              Assignee:
              Oleg Pudeyev (Inactive)
              Reporter:
              Oleg Pudeyev (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: