Method: Sequel::Model::DatasetMethods#destroy
- Defined in:
- lib/sequel/model/base.rb
permalink #destroy ⇒ Object
Destroy each row in the dataset by instantiating it and then calling destroy on the resulting model object. This isn’t as fast as deleting the dataset, which does a single SQL call, but this runs any destroy hooks on each object in the dataset.
Artist.dataset.destroy
# DELETE FROM artists WHERE (id = 1)
# DELETE FROM artists WHERE (id = 2)
# ...
2177 2178 2179 2180 2181 |
# File 'lib/sequel/model/base.rb', line 2177 def destroy @db.transaction(:server=>opts[:server], :skip_transaction=>model.use_transactions == false) do all(&:destroy).length end end |