Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Add 'groupings' option to number_to_phone helper

#1236

This will allow the method to handle many more countries. For example, mobile phones in Australia use the format "0412 345 678" and landlines use the format "(02) 1234 5678". The 'groupings' option makes generating these formats possible:

number_to_phone('0212345678', :groupings => [2, 4, 4], :area_code => true, :delimiter => " ") # => (02) 1234 5678

number_to_phone('0412345678', :groupings => [4, 3, 3], :delimiter => " ") # => 0412 345 678

Reported by Tim Morgan · October 19th, 2008 @ 11:57 PM

State: wontfix
Milestone: 2.x
Assigned to: Michael Koziarski Michael Koziarski
Importance: none

Activity

  1. Tim Morgan
    Tim Morgan

    This commit is also available on my fork of Rails here:

    http://github.com/seven1m/rails/...

    October 19th, 2008 @ 11:58 PM

  2. Tim Morgan
    Tim Morgan
    • Title changed from Add 'grouping' option to number_to_phone helper to Add 'groupings' option to number_to_phone helper

    October 19th, 2008 @ 11:59 PM

  3. Tim Morgan
  4. Michael Koziarski
    Michael Koziarski
    • Assigned user set to Michael Koziarski

    I'll take a look at this post 2.2, sorry you got no reply for a while.

    October 26th, 2008 @ 06:18 PM

  5. Pratik
    Pratik

    I think this should just be a custom helper method, rather than a core feature.

    March 6th, 2009 @ 04:23 PM

  6. Pratik
    Pratik
    • State changed from new to wontfix

    June 21st, 2009 @ 05:11 PM