diff options
author | Takeshi Umeda <noel.yoshiba@gmail.com> | 2022-10-22 21:30:59 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-22 14:30:59 +0200 |
commit | 53e86747e49dea5e4314bc3fedef4d69ba8f338e (patch) | |
tree | 8852115d6d4d094e006e0d5c96501c42984dea61 /app/models | |
parent | 1d34eff63f65dd0809af172cf3b1ed5e24c62eaf (diff) |
Fix duplicate featured tags (#19403)
* Fix duplicate featured tags * Add unique tag name validator * Fix error message
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/featured_tag.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/app/models/featured_tag.rb b/app/models/featured_tag.rb index 4a8d7224a..ec234a6fd 100644 --- a/app/models/featured_tag.rb +++ b/app/models/featured_tag.rb @@ -60,5 +60,6 @@ class FeaturedTag < ApplicationRecord def validate_tag_name errors.add(:name, :blank) if @name.blank? errors.add(:name, :invalid) unless @name.match?(/\A(#{Tag::HASHTAG_NAME_RE})\z/i) + errors.add(:name, :taken) if FeaturedTag.by_name(@name).where(account_id: account_id).exists? end end |