Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

HABTM creates duplicate row on push

#855

Say I have two classes, foo and bar which have and belong to many of each other.

foo < ActiveRecord::Base has_and_belongs_to_many :bars end

bar < ActiveRecord::Base has_and_belongs_to_many :foos end

I use the appropriate join table bars_foos. If I do

foo = Foo.find(1); foo.bars.push(Bar.find(1)); foo.bars.push(Bar.find(1));

two rows will be added into the bars_foos database with foo_id = 1 and bar_id = 1

Reported by Thijs de Vries · August 18th, 2008 @ 10:11 PM

State: wontfix
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. josh
    josh
    • State changed from new to wontfix

    November 22nd, 2008 @ 06:59 PM