6
7
8
9
10
11
12
13
|
# File 'app/services/postnhost/publishing/route_validator.rb', line 6
def self.validate!(slug:, article_id: nil, page_id: nil)
errors = []
errors << "slug has already been published by an article" if article_conflict?(slug, article_id)
errors << "slug has already been published by a page" if page_conflict?(slug, page_id)
errors << "slug conflicts with a category route" if Postnhost::Category.exists?(slug:)
errors << "slug conflicts with a static route" if static_slugs.include?(slug)
raise Error, errors if errors.any?
end
|