Change faker gem phone number format

faker, ruby, ruby-on-rails, rubygems

Solution

You can set custom format on the fly like this:

Faker::Base.numerify('+90(###) ### ####')

This will solve your problem.

Problem

Is there a way to control the format of the Phone number generated by faker? When I call: ``` Faker::PhoneNumber.cell_phone.to_i ``` I end up getting the wrong value. I also would like to not have extensions.

Original source