about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2021-02-26 22:07:00 -0600
committerStarfall <us@starfall.systems>2021-02-26 22:07:00 -0600
commit033b1b5b900babc9b068ddad0ae644c5f15e9ffe (patch)
tree76a4d5f8890836e855cccdf4ad7d58fd9c0159ee /app/models
parent35f9f9565e142b8c8e7541549046bad679f1438d (diff)
parent4aa860b65bd796b09dc0ceffa1fdd7de31060a34 (diff)
Merge remote-tracking branch 'glitchsoc/main' into main
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