Skip to content
Snippets Groups Projects
Unverified Commit 3b024c56 authored by Eugen Rochko's avatar Eugen Rochko Committed by GitHub
Browse files

Fix not being able to input featured tag with `#` (#19535)

parent ad83e647
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,8 @@ class FeaturedTag < ApplicationRecord
validate :validate_tag_name, on: :create
validate :validate_featured_tags_limit, on: :create
before_validation :strip_name
before_create :set_tag
before_create :reset_data
......@@ -48,6 +50,12 @@ class FeaturedTag < ApplicationRecord
private
def strip_name
return unless defined?(@name)
@name = @name&.strip&.gsub(/\A#/, '')
end
def set_tag
self.tag = Tag.find_or_create_by_names(@name)&.first
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment