about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2021-02-21 19:50:12 +0100
committerGitHub <noreply@github.com>2021-02-21 19:50:12 +0100
commit8331fdf7e0ea85ecc6d7dbff00b784bb6aa1f7d4 (patch)
tree044e1475cb6e31c5c33d02a4220c95f080667c59 /app/models
parentdcc7c686f3c4c85ebb8a3e6d5a861fc530c1840d (diff)
Add server rules (#15769)
Diffstat (limited to 'app/models')
-rw-r--r--app/models/rule.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/app/models/rule.rb b/app/models/rule.rb
new file mode 100644
index 000000000..7b62f2b35
--- /dev/null
+++ b/app/models/rule.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+# == Schema Information
+#
+# Table name: rules
+#
+#  id         :bigint(8)        not null, primary key
+#  priority   :integer          default(0), not null
+#  deleted_at :datetime
+#  text       :text             default(""), not null
+#  created_at :datetime         not null
+#  updated_at :datetime         not null
+#
+class Rule < ApplicationRecord
+  include Discard::Model
+
+  self.discard_column = :deleted_at
+
+  validates :text, presence: true, length: { maximum: 300 }
+
+  scope :ordered, -> { kept.order(priority: :asc) }
+end