Project

General

Profile

Actions

Bug #367

closed

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

Added by Bash Shell over 13 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Database
Target version:
Difficulty:
Triaged:
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.

Actions #1

Updated by Ohad Levy over 13 years ago

patch? :)

Actions #2

Updated by Ohad Levy over 13 years ago

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

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

Actions #4

Updated by Paul Kelly over 13 years ago

  • % Done changed from 0 to 100
Actions #5

Updated by Paul Kelly over 13 years ago

  • Status changed from Ready For Testing to Closed
Actions

Also available in: Atom PDF