favgroups: don't allow favgroups to be named 'any' or 'none'.

'any' and 'none' are now reserved keywords for the favgroup: metatag.

Also add a fix script to rename existing favgroups.
This commit is contained in:
evazion
2022-04-17 23:07:19 -05:00
parent db49a4fbff
commit 703fd05025
2 changed files with 16 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ class FavoriteGroup < ApplicationRecord
validates :name, presence: true
validates :name, uniqueness: { case_sensitive: false, scope: :creator_id }
validates :name, format: { without: /,/, message: "cannot have commas" }
validates :name, exclusion: { in: %w[any none], message: "can't be '%{value}'" }
validate :creator_can_create_favorite_groups, :on => :create
validate :validate_number_of_posts
validate :validate_posts