aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-11-14 16:14:33 +0000
committerMatthew Lemon <y@yulqen.org>2024-11-14 16:14:33 +0000
commit851521dc475e3d434ff8e13bd9f9e558aa9af772 (patch)
treed0ca4cbdbcc6ab506c146349199bb3437d0e4802 /app/models
parent6427b28c60c6ed0dfd637307d1ab4ffe65c1144d (diff)
Improved the feature slot handling - can now remove feature_slot value
Diffstat (limited to 'app/models')
-rw-r--r--app/models/pdfresource.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/pdfresource.rb b/app/models/pdfresource.rb
index 4fa2292..8e59972 100644
--- a/app/models/pdfresource.rb
+++ b/app/models/pdfresource.rb
@@ -4,7 +4,8 @@ class Pdfresource < ApplicationRecord
has_many_attached :pdf_snapshots
belongs_to :resource_type
validates :feature_slot,
- numericality: { only_integer: true, greater_than_or_equal_to: 1, less_than_or_equal_to: 3, allow_nil: true },
+ inclusion: { in: [ 1, 2, 3 ], message: "must be 1, 2, or 3" },
+ uniqueness: { message: "is already taken by another featured resource" },
allow_nil: true
validate :validate_pdf_count
validates :name, :thumbnails, :description, :card_description, :pdfs, :credits, presence: true