Browse Source

Fix featured tag form not failing on failed tag validations (#10167)

pull/4/head
Eugen Rochko 5 years ago
committed by GitHub
parent
commit
5d3e7cee99
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      app/models/featured_tag.rb

+ 3
- 2
app/models/featured_tag.rb View File

@ -18,11 +18,12 @@ class FeaturedTag < ApplicationRecord
delegate :name, to: :tag, allow_nil: true
validates :name, presence: true
validates_associated :tag, on: :create
validates :name, presence: true, on: :create
validate :validate_featured_tags_limit, on: :create
def name=(str)
self.tag = Tag.find_or_initialize_by(name: str.delete('#').mb_chars.downcase.to_s)
self.tag = Tag.find_or_initialize_by(name: str.strip.delete('#').mb_chars.downcase.to_s)
end
def increment(timestamp)

Loading…
Cancel
Save