validation help

i use this code to validate the phone should have only numbers.
but it also accepts alphapets with should not accept other
than numkbers
below is my code i use.
errors.add(:phone_code, "*please enter valid phone number") unless
self.phone_code =~/[0-9]/

That will match if there is at least one number in the string. I think
you need something like

or possibly even better you could use something like
validates_numericality_of :phone_code, :only_integer => true, :greater_than => 0
Though I think this would allow a leading + character.


if you are going to use a regexp you might as well use
validates_format_of rather than doing it yourself