PostSetPresenters::Post#related_posts: clean up metatag parsing (#2894).
* Fix `#related_tags` to use `Tag.has_metatag?`. * Fix Tag::SUBQUERY_METATAGS and Tag::METATAGS to be arrays instead of regexes.
This commit is contained in:
@@ -21,7 +21,7 @@ class TagNameValidator < ActiveModel::EachValidator
|
||||
record.errors[attribute] << "'#{value}' cannot contain non-printable characters"
|
||||
when /[^[[:ascii:]]]/
|
||||
record.errors[attribute] << "'#{value}' must consist of only ASCII characters"
|
||||
when /\A(#{Tag::METATAGS}|#{Tag::SUBQUERY_METATAGS}):(.+)\z/i
|
||||
when /\A(#{Regexp.union(Tag::METATAGS)}):(.+)\z/i
|
||||
record.errors[attribute] << "'#{value}' cannot begin with '#{$1}:'"
|
||||
when /\A(#{Tag.categories.regexp}):(.+)\z/i
|
||||
record.errors[attribute] << "'#{value}' cannot begin with '#{$1}:'"
|
||||
|
||||
Reference in New Issue
Block a user