Class: SlugValidator::DefaultValidator

Inherits:
InstanceValidator show all
Defined in:
app/validators/slug_validator.rb

Instance Method Summary collapse

Methods inherited from InstanceValidator

#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

Returns:

  • (Boolean)


161
162
163
# File 'app/validators/slug_validator.rb', line 161

def applicable?
  true
end

#validate!Object



165
166
167
# File 'app/validators/slug_validator.rb', line 165

def validate!
  record.errors[attribute] << "must be usable in a url" unless valid_slug?(value)
end