joost/phony_rails — pull request #24 by mjc (2013-05-07 19:17:43+00:00)
Title: Fix default_country_number appending repeatedly

The regex for appending default country number doesn't correctly check if the actual country code is already there.
```
default_country_number = 1
number = '9545551212'
number = "#{default_country_number}#{number}" if not number =~ /^(00|\+)/
=> "19545551212"

number = "19545551212"
number = "#{default_country_number}#{number}" if not number =~ /^(00|\+)/
=> "119545551212"
```

etc.

Fixed:
```
default_country_number = 1
number = '9545551212'
number = "#{default_country_number}#{number}" if not number =~ /^(00|\+)?#{default_country_number}/
=> "19545551212"
number = "#{default_country_number}#{number}" if not number =~ /^(00|\+)?#{default_country_number}/
=> "19545551212"
```

Sponsored-by: CentroNet Marketing