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.

Several join records are created when using nested_attributes in HABTM

#3575

When creating a new instance using nested attributes, several records in the join table are created.

Attached a test that proves the bug for HasAndBelongsToMany association. The bug has been also detected in has_many :through associations.

Bug was introduced in commit 6b2291f33063b6742cba84f5f64e03de9907c1f8, hence I'm assigning a responsible :-)

Reported by Antonio Tapiador · December 15th, 2009 @ 03:57 PM

State: resolved
Milestone: 2.3.6
Assigned to: Eloy Duran Eloy Duran
Importance: Low

Activity

  1. Antonio Tapiador
    Antonio Tapiador
    • Title changed from Multiple join records when using nested_attributes in HABTM to Several join records are created when using nested_attributes in HABTM

    December 15th, 2009 @ 03:59 PM

  2. Eloy Duran
    Eloy Duran
    • State changed from new to verified
    • Milestone set to 2.3.6

    Should be in upstream repo in the next few days I expect: http://github.com/Fingertips/rails/commit/146a7505680cbb646c0b9d55d...

    December 28th, 2009 @ 04:10 PM

  3. Repository
    Repository
    • State changed from verified to resolved

    (from [146a7505680cbb646c0b9d55dca7cc8494b36e47]) Make sure to not add autosave callbacks multiple times. [#3575 state:resolved]

    This makes sure that, in a HABTM association, only one join record is craeted.
    http://github.com/rails/rails/commit/146a7505680cbb646c0b9d55dca7cc...

    December 28th, 2009 @ 08:29 PM

  4. Repository
    Repository

    (from [9c771a9608f54ebdfcb6fca819c83038489ce50d]) Make sure to not add autosave callbacks multiple times. [#3575 state:resolved]

    This makes sure that, in a HABTM association, only one join record is craeted.
    http://github.com/rails/rails/commit/9c771a9608f54ebdfcb6fca819c830...

    December 28th, 2009 @ 08:52 PM

  5. Jeff Kreeftmeijer
    Jeff Kreeftmeijer
    • Tag cleared.
    • Importance changed from to Low

    Automatic cleanup of spam.

    November 7th, 2010 @ 04:55 PM