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.

delete_all doesn't respect scope

#3489

This was tested in latest 2.3 stable branch:

>> Media.scoped(:conditions => 'size = 0').all
Media Load (0.4ms)  SELECT * FROM `medias` WHERE (size = 0)
>> Media.scoped(:conditions => 'size = 0').delete_all
Media Delete all (0.3ms)  DELETE FROM `medias`

It had caused me to delete all the records from one of our tables in production.

Reported by Mislav · November 17th, 2009 @ 01:33 PM

State: invalid
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Mislav
    Mislav

    Cancel this. Further investigation showed that this is not broken in ActiveRecord, only in our app. Turned out the "is_paranoid" plugin re-defines delete_all to use an exclusive scope.

    November 17th, 2009 @ 01:40 PM

  2. CancelProfileIsBroken
    CancelProfileIsBroken
    • State changed from new to invalid

    November 17th, 2009 @ 02:43 PM