Sha256: 70219ce937e0886d8381b6d2709fc0bb6ff533180b66e853318c47b482449a83
Contents?: true
Size: 934 Bytes
Versions: 40
Compression:
Stored size: 934 Bytes
Contents
require 'subj_models/concerns/comprising_external_id' require 'subj_models/services/values_checker' module SubjModels module OfficeContactModule include SubjModels::TypesSupport::ContactTypes include SubjModels::ValuesChecker def self.included(including_class) including_class.class_eval do include SubjModels::ComprisingExternalId enum contact_type: CONTACT_TYPES belongs_to :office belongs_to :manager validates :contact_type, inclusion: { in: contact_types.keys } scope :is_phone, -> { where(contact_type: PHONE) } scope :is_skype, -> { where(contact_type: SKYPE) } scope :is_address, -> { where(contact_type: ADDRESS) } scope :is_email, -> { where(contact_type: EMAIL) } scope :office_id, -> (office_id) { parent_id_scope("office", office_id) } end end def to_s id.to_s # TODO end end end
Version data entries
40 entries across 40 versions & 2 rubygems