Sha256: e73917b7f107694075a17210c53f4a353c6892ec119766158361684b3383f36b

Contents?: true

Size: 968 Bytes

Versions: 2

Compression:

Stored size: 968 Bytes

Contents

class CorporateContact
  include ActiveModel::Model


  attr_accessor :telephone, :contact_url, :contact_type, :area_served,
                :available_language

  validates :telephone,
      format: { with: /(\A\+[1-9][\d*| *|\-]+\z|\A\z)/,
      message: 'international_number'},
      absence: { if: Proc.new{|u| u.contact_type.blank? },
        message: 'contact_type_blank' }
  validates :contact_url,
      absence: { if: Proc.new{|u| u.contact_type.blank? },
        message: 'contact_type_blank' }
  validates :area_served,
      absence: { if: Proc.new{|u| !u.area_served.join.blank? && u.contact_type.blank? },
        message: 'contact_type_blank' }
  validates :available_language,
      absence: { if: Proc.new{|u| !u.available_language.join.blank? && u.contact_type.blank? },
        message: 'contact_type_blank' }
  validates :contact_type,
      absence: { if: Proc.new{|u| u.telephone.blank? && u.contact_url.blank? },
        message: 'blank' }
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
comfortable_mexican_loveseat-0.1.1 app/services/corporate_contact.rb
comfortable_mexican_loveseat-0.1.0 app/services/corporate_contact.rb