Theocacao
Leopard
Design Element
Comment on "Rails validates_length_of and Fixnum"
by noell — Nov 01
For string zipcodes you can also use a regexp to validate:

unless zipcode =~ /^([^\d]*?\d){5}$/
puts "No"
else
puts "Yes"
end

Btw, you also can use a construct like /^(regexp1|regexp2)$/ to match two different numbers.
Back to "Rails validates_length_of and Fixnum"
Design Element

Copyright © Scott Stevenson 2004-2015