Delete one step in Ruby on Rails

How to send such a request to the database server from the Rake task without deleting the record by record in "every" cycle?

delete from data where uuid in ( select uuid from data group by uuid, raw, recdate having count(*)>1 ); 
+7
source share
1 answer

ActiveRecord has a delete_all method for you. Note that it does not call destroy callbacks. http://api.rubyonrails.org/classes/ActiveRecord/Relation.html#method-i-delete_all

+7
source

All Articles