In the database, the telephone field is stored as a string of numbers. However, I want to present it in the view as (999) 999-9999. I came up with a regular expression with gsub. It works in the console but not in the view.
Here is the example:
I had to put this in the controller to make this work. But I'd rather it be in the model or the view, whichever is best. This information is going to be read only.
Then in the view I just call
<%h= @credential.Telephone %> # if I use gsub here instead of the controller it doesn't work
How can I make this work in th emodel or view?
And sorry if this is a non-IDE question. Is this forum only for IDE-related questions?
Thanks in advance....