about summary refs log tree commit diff
path: root/app/models/featured_tag.rb
diff options
context:
space:
mode:
authorJames Tucker <jftucker@gmail.com>2022-11-09 20:49:30 -0800
committerGitHub <noreply@github.com>2022-11-10 05:49:30 +0100
commit78a6b871fe3dae308380ea88132ddadc86a1431e (patch)
tree355c20f14f76d034c9e2b9e90d2e9c86745d4b87 /app/models/featured_tag.rb
parent0cd0786aef140ea41aa229cd52ac67867259a3f5 (diff)
Improve performance by avoiding regex construction (#20215)
```ruby
10.times { p /#{FOO}/.object_id }
10.times { p FOO_RE.object_id }
```
Diffstat (limited to 'app/models/featured_tag.rb')
-rw-r--r--app/models/featured_tag.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/featured_tag.rb b/app/models/featured_tag.rb
index debae2212..70f949b6a 100644
--- a/app/models/featured_tag.rb
+++ b/app/models/featured_tag.rb
@@ -17,7 +17,7 @@ class FeaturedTag < ApplicationRecord
   belongs_to :account, inverse_of: :featured_tags
   belongs_to :tag, inverse_of: :featured_tags, optional: true # Set after validation
 
-  validates :name, presence: true, format: { with: /\A(#{Tag::HASHTAG_NAME_RE})\z/i }, on: :create
+  validates :name, presence: true, format: { with: Tag::HASHTAG_NAME_RE }, on: :create
 
   validate :validate_tag_uniqueness, on: :create
   validate :validate_featured_tags_limit, on: :create