how to remove spaces from phone number

Rm Rm wrote:

I need to allow login based on the phone number. During the signup they
can give the number in any format with spaces, slash or (). But for
storing in database and then during login to compare I just want the 10
digit number. How can I remove the special char from phone number before
storing to db ?

before_save {|o| o.phone_number.gsub!(/\D/, "")

or something like that. I don't recall if before_save accepts a block
like that, though. If it doesn't just create a named method instead and
call that from before_filter.