# Items.destroy doesn't work

**URL:** <https://www.ruby-forum.com/t/items-destroy-doesnt-work/157047>\
**Category:** Rails\
**Created:** [January 6, 2009, 9:22pm UTC](https://www.ruby-forum.com/t/items-destroy-doesnt-work/157047 "2009-01-06T21:22:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![scottnj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b9e5f3/32.png) [@scottnj](https://www.ruby-forum.com/u/scottnj)\
**Post date:** [January 6, 2009, 9:22pm UTC](https://www.ruby-forum.com/t/items-destroy-doesnt-work/157047/1 "2009-01-06T21:22:55Z")

</div>

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|  
item.destroy  
end  
end

there must be a better way

---

<div class="post-metadata">

**Author:** ![scottnj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b9e5f3/32.png) [@scottnj](https://www.ruby-forum.com/u/scottnj)\
**Post date:** [January 6, 2009, 10:45pm UTC](https://www.ruby-forum.com/t/items-destroy-doesnt-work/157047/2 "2009-01-06T22:45:44Z")

</div>

How about

Item.destroy\_all(conditions)

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.

> **[ActiveRecord::Base](https://api.rubyonrails.org/classes/ActiveRecord/Base.html#M001974)**
>
> Active Record Active Record objects don't specify their attributes directly, but rather infer them from the table definition with which they're linked.
