From 6aff51080944e220ac1ad4a3b5bd0f55d2f37fe5 Mon Sep 17 00:00:00 2001 From: Daniel Waterworth Date: Thu, 12 Dec 2019 11:13:42 +0000 Subject: [PATCH] FIX: Disallow none as a category slug --- app/models/category.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/models/category.rb b/app/models/category.rb index 5af5eabac34..a38868add4a 100644 --- a/app/models/category.rb +++ b/app/models/category.rb @@ -1,6 +1,10 @@ # frozen_string_literal: true class Category < ActiveRecord::Base + RESERVED_SLUGS = [ + 'none' + ] + self.ignored_columns = %w{ uploaded_meta_id suppress_from_latest @@ -59,6 +63,7 @@ class Category < ActiveRecord::Base validate :permissions_compatibility_validator validates :auto_close_hours, numericality: { greater_than: 0, less_than_or_equal_to: 87600 }, allow_nil: true + validates :slug, exclusion: { in: RESERVED_SLUGS } after_create :create_category_definition