Project

General

Profile

Bug #367

Regex for "validates_format_of" in Parameter model does not look right

Added by Bash Shell about 11 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Database
Target version:
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

I have a parameter value with the value:

test       value

However, I got a validation error because the following validation does not accept a variety of characters.

validates_format_of   :name, :value, :with => /\A(\S+\s?)+\Z/, :message => "can't be blank or contain trailing white space" 

It would be useful to have a more liberal validation like so:

validates_format_of   :name, :value, :with => /^[\w\d\W]+$/, :message => "can't be blank or contain trailing white space" 

So that the following lines can be accommodated:

*       -       nofile  65535%%*       -       nproc  65535

for /etc/security/limits.conf, for example.

Associated revisions

Revision 1f0c2f2e (diff)
Added by Paul Kelly about 11 years ago

Fixes #367 - Parameter validates_format_of is too restrictive

Revision 41ca560a (diff)
Added by Paul Kelly about 11 years ago

Fixes #367 - Parameter validates_format_of is too restrictive

History

#1 Updated by Ohad Levy about 11 years ago

patch? :)

#2 Updated by Ohad Levy about 11 years ago

  • Category set to Database
  • Assignee set to Bash Shell
  • Target version set to 0.1-6

#3 Updated by Paul Kelly about 11 years ago

  • Status changed from New to Ready For Testing
  • Branch set to bug/367-validates_format_of-parameter

Oops! Sorry about this Bash Shell but I did this fix before I noticed that it was assigned to you. :-(
However I think that the re should be /^.*\S$/

#4 Updated by Paul Kelly about 11 years ago

  • % Done changed from 0 to 100

#5 Updated by Paul Kelly about 11 years ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF