aboutsummaryrefslogtreecommitdiff
path: root/app/models/taxonomy.rb
diff options
context:
space:
mode:
authorhellekin <hellekin@cepheide.org>2020-10-08 16:59:55 +0200
committerhellekin <hellekin@cepheide.org>2020-10-08 16:59:55 +0200
commit00ac912be46d858379fb5685b7290fe8d60001ef (patch)
tree6eb7c1cb2e75d58f40d41479267dfa2e381c678f /app/models/taxonomy.rb
parent12cd55048f1357a3e3dc384db37b9f4edb6819d7 (diff)
parent8f691b566ffbc79f1d2d7a3f67d8607cc03a789c (diff)
downloadincommon-map-00ac912be46d858379fb5685b7290fe8d60001ef.tar.gz
Merge branch 'taxonomies'
Diffstat (limited to 'app/models/taxonomy.rb')
-rw-r--r--app/models/taxonomy.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/models/taxonomy.rb b/app/models/taxonomy.rb
new file mode 100644
index 0000000..0810fc0
--- /dev/null
+++ b/app/models/taxonomy.rb
@@ -0,0 +1,17 @@
+class Taxonomy < ApplicationRecord
+ # Universally Unique Identifier :uuid
+ include UUIDParameter
+
+ default_scope { order(created_at: :asc) }
+
+ belongs_to :agent
+ has_many :categories, -> { order(rank: :asc) }, dependent: :destroy, inverse_of: :taxonomy
+ has_many :sections, -> { order(rank: :asv) }, through: :categories
+
+ validates :name,
+ presence: true,
+ uniqueness: true,
+ length: 3..64
+ validates :summary,
+ length: 0..136
+end