Skip to content

Instantly share code, notes, and snippets.

@hwatkins
Created December 18, 2010 14:40
Show Gist options
  • Save hwatkins/746557 to your computer and use it in GitHub Desktop.
Save hwatkins/746557 to your computer and use it in GitHub Desktop.
Telephone number link
module ApplicationHelper
def phone_number_link(text)
sets_of_numbers = text.scan(/[0-9]+/)
number = "+1-#{sets_of_numbers.join('-')}"
link_to text, "tel:#{number}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment