Validate Length


#1

I’m trying to validate that someone enters an 8 digit number exactly.
I’m using the following line but it does not seem to work. Can anyone
help?

validates_length_of :debt_ref, :is =>8, :message =>"- The debtref can
only be 8 digits long"


#2

On 2/12/07, doucie removed_email_address@domain.invalid wrote:

I’m trying to validate that someone enters an 8 digit number exactly.
I’m using the following line but it does not seem to work. Can anyone
help?

validates_length_of :debt_ref, :is =>8, :message =>"- The debtref can
only be 8 digits long"

Your syntax looks right - what is the error that you’re seeing?


Zack C.
http://depixelate.com


#3

Zack C. wrote:

On 2/12/07, doucie removed_email_address@domain.invalid wrote:

I’m trying to validate that someone enters an 8 digit number exactly.
I’m using the following line but it does not seem to work. Can anyone
help?

validates_length_of :debt_ref, :is =>8, :message =>"- The debtref can
only be 8 digits long"

Your syntax looks right - what is the error that you’re seeing?


Zack C.
http://depixelate.com

There is no error, the model just accepts a number greater than 8
digits!