Hi,
I wonder if anyone can advise a Rails novice on how to achieve the following.
I am creating a contacts database and telephone numbers are part of it, the majority of which will be UK telephone numbers along with a small percentage of Irish telephone numbers.
I have defined the telephone number in the schema as an integer which means that when i go to display the telephone number it displays without a zero at the beginning and no other formatting.
I have discovered the number_to_phone() helper which is currently formatting a number entered into the database as 08453226838 as 845-322-6838 which is great but it drops the leading zero!!
Does anyone know how i can add the leading zero?
On a separate note, Irish numbers would be typed into the system starting with 00353 so i need help in understanding how to say If '353' add '00' in place of the above leading zero.
Hope that makes sense, any help is much appreciated.


Reply With Quote