Happy Phone Number is a cool open-source plugin for Rails that helps you easily format phone numbers from your Rails models. How great is that?
Right now, it supports several countries like Belgium (:be), Denmark (:dk), France (:fr), and Iceland (:is). Just keep in mind, Happy Phone Number works best when phone numbers are saved with just the digits.
If you want to add this gem to your project, here’s how:
gem 'happy_phone_number', :git => 'git://github.com/lkdjiin/happy_phone_number.git'
Next up, you'll want to include the happy_phone_number method in your Rails model. Here’s a quick example:
class Contact < ActiveRecord::Base
attr_accessible :email, :name, :phone, :fax
happy_phone_number
end
Now that you’ve set it up, using it in your views is super simple! You can do something like this:
happy_phone(:fr)
happy_fax(:fr)
...
Go to the Softpas website, press the 'Downloads' button, and pick the app you want to download and install—easy and fast!
SoftPas is your platform for the latest software and technology news, reviews, and guides. Stay up to date with cutting-edge trends in tech and software development.
Subscribe to newsletter
© Copyright 2024, SoftPas, All Rights Reserved.