Class: SlugValidator::HelpPageValidator
Instance Method Summary
collapse
#ends_with?, #of_kind?, #starts_with?, #url_after_first_slash, #url_after_first_slash_is_valid_slug!, #url_parts, #valid_slug?
Instance Method Details
#applicable? ⇒ Boolean
86
87
88
|
# File 'app/validators/slug_validator.rb', line 86
def applicable?
of_kind?('help_page')
end
|
#validate! ⇒ Object
90
91
92
93
|
# File 'app/validators/slug_validator.rb', line 90
def validate!
record.errors[attribute] << "Help page slugs must have a help/ prefix" unless starts_with?("help/")
url_after_first_slash_is_valid_slug!
end
|