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.
http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M001974
On Jan 6, 3:22 pm, scott <scot...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> 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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---