Forum: Ruby on Rails items.destroy doesn't work

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Eecd295cdec2454c66e2015036a39408?d=identicon&s=25 Scott Nj (scottnj)
on 2009-01-06 21:22
(Received via mailing list)
why doesn't this work
items.destroy if items = find(:all, :conditions => ...)

right now i have this that works, but it seems ugly and inefficient.

if items = find(:all, :conditions => ...)
  items.each do |item|

there must be a better way
53be54e5db4dc58e4980db5a8255621b?d=identicon&s=25 Harold (Guest)
on 2009-01-06 22:45
(Received via mailing list)
How about


Which will call the destroy callback methods (slow if you are
destroying many records).

If you don't care about callbacks, use delete_all instead.
This topic is locked and can not be replied to.