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.

Rename _delete to _destroy in nested attributes

#2889

When nested attributes was released in 2.3 it came with a small inconsistency. The DSL uses :allow_destroy, the method called in the associated object is :destroy but the trigger is called _delete:

  accepts_nested_attributes_for :tasks, :allow_destroy => true

This patch changes _delete to _destroy but adds a deprecation warning. Documentation was also updated.

As already discussed in the mailing list, someone wanted to add a _delete behavior that will actually delete the associated record. So renaming _delete to _destroy now makes room for improvements in the future.

Reported by José Valim · July 9th, 2009 @ 09:59 AM

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

Activity

  1. iain
    iain

    +1 the difference between destroy and delete is quite confusing, let's minimize the confusion

    July 9th, 2009 @ 10:25 AM

  2. Eloy Duran
    Eloy Duran
    • Assigned user set to Eloy Duran

    July 11th, 2009 @ 12:16 PM

  3. Eloy Duran
    Eloy Duran
    • State changed from new to verified
    • Milestone changed from 2.x to 2.3.4

    I have verified and applied this patch on my branch of 2-3-stable, which Micheal will look at and merge in before 2.3.4.

    http://github.com/alloy/rails/commit/6d4637be2adee0caafcfb7d5a98837...

    Thanks!

    July 12th, 2009 @ 12:40 PM

  4. Jeremy Kemper
    Jeremy Kemper
    • Milestone changed from 2.3.4 to 2.3.6

    [milestone:id#50064 bulk edit command]

    September 11th, 2009 @ 11:04 PM

  5. Repository
    Repository
    • State changed from verified to resolved

    (from [11c338735c3f6e9562c4c82ccd8913dd8b7a6a80]) Rename nested attributes delete to destroy to reflect its actual behavior and DSL (:allow_destroy). Deprecation warning added. [#2889 state:resolved] Signed-off-by: Eloy Duran eloy.de.enige@gmail.com
    http://github.com/rails/rails/commit/11c338735c3f6e9562c4c82ccd8913...

    September 13th, 2009 @ 02:33 AM

  6. Repository
    Repository

    (from [3091252abaafd15bc085f0be2b17829bebb6522c]) Rename nested attributes delete to destroy to reflect its actual behavior and DSL (:allow_destroy). Deprecation warning added. [#2889 state:resolved] Signed-off-by: Eloy Duran eloy.de.enige@gmail.com
    http://github.com/rails/rails/commit/3091252abaafd15bc085f0be2b1782...

    September 13th, 2009 @ 02:33 AM

  7. Dudley Flanders
    Dudley Flanders

    The commit missed a couple of comments and examples that still use the old :_delete key.

    March 29th, 2010 @ 10:26 PM

  8. José Valim
    José Valim

    Thanks for the patch, applied!

    March 30th, 2010 @ 12:41 AM