Created
December 18, 2010 14:40
-
-
Save hwatkins/746557 to your computer and use it in GitHub Desktop.
Telephone number link
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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