Sha256: 02f798b43b4440592fc1d9b57ad424174338f48afe1cf686f35d30789ab46d0d

Contents?: true

Size: 419 Bytes

Versions: 12

Compression:

Stored size: 419 Bytes

Contents

class PhoneNumber < ActiveRecord::Base
  belongs_to :vcard
  belongs_to :object, :polymorphic => true

  validates_presence_of :number

  def label
    case phone_number_type
    when 'phone'
      "Tel:"
    when 'fax'
      "Fax:"
    when 'mobile'
      "Mob:"
    when 'email'
      "Mail:"
    else
      ""
    end
  end
  
  def to_s(separator = " ")
    return [label, number].compact.join(separator)
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
has_vcards-0.8.1 app/models/phone_number.rb
has_vcards-0.8.0 app/models/phone_number.rb
has_vcards-0.7.2 app/models/phone_number.rb
has_vcards-0.7.1 app/models/phone_number.rb
has_vcards-0.7.0 app/models/phone_number.rb
has_vcards-0.6.1 app/models/phone_number.rb
has_vcards-0.6.0 app/models/phone_number.rb
has_vcards-0.5.6 app/models/phone_number.rb
has_vcards-0.5.5 app/models/phone_number.rb
has_vcards-0.5.4 app/models/phone_number.rb
has_vcards-0.5.3 app/models/phone_number.rb
has_vcards-0.5.1 app/models/phone_number.rb