aboutsummaryrefslogtreecommitdiff
path: root/app/models/section.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/section.rb')
-rw-r--r--app/models/section.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/section.rb b/app/models/section.rb
new file mode 100644
index 0000000..a9d163e
--- /dev/null
+++ b/app/models/section.rb
@@ -0,0 +1,10 @@
+class Section < ApplicationRecord
+ belongs_to :category
+ has_ony :taxonomy, through: :category
+
+ acts_as_list column: :rank, scope: :category
+
+ validates :name,
+ uniqueness: { scope: category_id },
+ length: 3..64
+end