Sha256: 2608c25c371096865986c926641672e2f0529ae5f6b19d658f0825de5cac30ca
Contents?: true
Size: 1013 Bytes
Versions: 11
Compression:
Stored size: 1013 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 def contact_type=(value) super(check_string_for_int(value)) end end end
Version data entries
11 entries across 11 versions & 1 rubygems