We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8edc744 commit 08d373bCopy full SHA for 08d373b
1 file changed
app/models/featured_tag.rb
@@ -18,11 +18,12 @@ class FeaturedTag < ApplicationRecord
18
19
delegate :name, to: :tag, allow_nil: true
20
21
- validates :name, presence: true
+ validates_associated :tag, on: :create
22
+ validates :name, presence: true, on: :create
23
validate :validate_featured_tags_limit, on: :create
24
25
def name=(str)
- self.tag = Tag.find_or_initialize_by(name: str.delete('#').mb_chars.downcase.to_s)
26
+ self.tag = Tag.find_or_initialize_by(name: str.strip.delete('#').mb_chars.downcase.to_s)
27
end
28
29
def increment(timestamp)
0 commit comments