summaryrefslogtreecommitdiff
path: root/app/models/concerns
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/concerns')
-rw-r--r--app/models/concerns/delete_with_limit.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/concerns/delete_with_limit.rb b/app/models/concerns/delete_with_limit.rb
new file mode 100644
index 00000000000..1ea18b6149b
--- /dev/null
+++ b/app/models/concerns/delete_with_limit.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+module DeleteWithLimit
+ extend ActiveSupport::Concern
+
+ class_methods do
+ def delete_with_limit(maximum)
+ limit(maximum).delete_all
+ end
+ end
+end