Revision 59712296
Added by Ondřej Pražák about 9 years ago
app/validators/no_whitespace_validator.rb | ||
---|---|---|
class NoWhitespaceValidator < ActiveModel::EachValidator
|
||
def validate_each(record, attribute, value)
|
||
record.errors.add(attribute, _("can't contain white spaces.")) if value =~ /\s/
|
||
record.errors.add(attribute, _("can't contain spaces.")) if value =~ /\s/
|
||
end
|
||
end
|
Also available in: Unified diff
Fixes #9439 - 'white spaces' changed to 'spaces' in validation error message