Given the following:
@users = User.where(:state => 1)
which 15 for: @users.length
In the rails console, is there a way to then delete all those records, perhaps by doing something like @users.delete
?
@users = User.where(:state => 1)
The simplest way is to use destroy_all
or delete_all
:
@users.destroy_all
# OR
@users.delete_all
That's all
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With