Hi there
I’m trying to delete a set of active record objects based on certain
conditions. I’d like to do something like the following:
Context.delete_all("uri IN (?)", uris)
But delete_all doesn’t allow multiple arguments. Since I don’t have
the IDs for the objects I want to delete, I can’t use delete(id), and
have resorted to this, which is significantly slower since it has to
instantiate each object, and there are individual SQL statements for
each delete. Am I missing something obvious?
contexts = Context.find(:all, :include => :terms,
:conditions => ["uri IN (?)", uris])
contexts.each do |context|
context.destroy
end
Thanks
Lance