Bug #367

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

Added by Bash Shell over 1 year ago. Updated over 1 year ago.

Status:Closed Start:08/26/2010
Priority:Normal Due date:
Assigned to:Bash Shell % Done:

100%

Category:Database
Target version:0.1-6
Backlog: Difficulity:
Votes: 0

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 1f0c2f2ef54f77a3b559c8d2119168395c51ff44
Added by Paul Kelly over 1 year ago

Fixes #367 - Parameter validates_format_of is too restrictive

Revision 41ca560a016f0d130b582f54ddc5f96f01fdd9b0
Added by Paul Kelly over 1 year ago

Fixes #367 - Parameter validates_format_of is too restrictive

History

Updated by Ohad Levy over 1 year ago

patch? :)

Updated by Ohad Levy over 1 year ago

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

Updated by Paul Kelly over 1 year 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$/

Updated by Paul Kelly over 1 year ago

  • % Done changed from 0 to 100

Updated by Paul Kelly over 1 year ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF