Module: SubjModels::NomenclatureFileModule
Constant Summary
TypesSupport::FileTypes::FILE_TYPES, TypesSupport::FileTypes::PDF, TypesSupport::FileTypes::PICTURE, TypesSupport::FileTypes::VIDEO
Class Method Summary
collapse
Instance Method Summary
collapse
#check_string_for_int
Class Method Details
.included(including_class) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/subj_models/nomenclature_file.rb', line 13
def self.included(including_class)
including_class.class_eval do
include SubjModels::SharedScopes
include SubjModels::ComprisingExternalId
enum file_type: FILE_TYPES
belongs_to :nomenclature
belongs_to :document_file
validates :file_type, inclusion: { in: file_types.keys }
validates :name, :document_file, presence: true
scope :nomenclature_id, -> (nomenclature_id) { parent_id_scope("nomenclature", nomenclature_id) }
end
end
|
Instance Method Details
#file_type=(value) ⇒ Object
38
39
40
|
# File 'lib/subj_models/nomenclature_file.rb', line 38
def file_type=(value)
super(check_string_for_int(value))
end
|
#to_s ⇒ Object
34
35
36
|
# File 'lib/subj_models/nomenclature_file.rb', line 34
def to_s
name.to_s
end
|