Rails number_to_phone:从电话号码中删除国家/地区代码

Ste*_*ili 2 ruby ruby-on-rails

我有一个应用程序存储电话号码'+11231231234'.为了方便用户,我将其转换为:+1(123) 123-1234在视图中.我number_to_phone在rails中使用helper来做到这一点:

<%= number_to_phone(call.From, :area_code => true) %>
Run Code Online (Sandbox Code Playgroud)

我也想+1从视图中删除.如果前两个字符是,我需要写什么来删除电话号码的前两个字符+1

Kyl*_*yle 9

number_to_phone(call.From, :area_code => true).gsub(/^\+\d/, '')
Run Code Online (Sandbox Code Playgroud)