Validate Length

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"

On 2/12/07, doucie [email protected] 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

Zack C. wrote:

On 2/12/07, doucie [email protected] 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!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs