Module: SubjModels::OfficeContactModule
Constant Summary
TypesSupport::ContactTypes::ADDRESS, TypesSupport::ContactTypes::CONTACT_TYPES, TypesSupport::ContactTypes::EMAIL, TypesSupport::ContactTypes::PHONE, TypesSupport::ContactTypes::SKYPE
Class Method Summary
collapse
Instance Method Summary
collapse
#check_string_for_int
Class Method Details
.included(including_class) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/subj_models/office_contact.rb', line 11
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
|
Instance Method Details
#to_s ⇒ Object
35
36
37
|
# File 'lib/subj_models/office_contact.rb', line 35
def to_s
id.to_s end
|