Module: Shared::Documentation

Extended by:
ActiveSupport::Concern
Included in:
CharacterState, CollectingEvent, Descriptor, Loan, Protocol, Sequence, Source
Defined in:
app/models/concerns/shared/documentation.rb

Overview

Shared code for documenting objects, i.e. linking a document to a data instance.

Instance Method Summary collapse

Instance Method Details

#document_array=(documents) ⇒ Object



23
24
25
# File 'app/models/concerns/shared/documentation.rb', line 23

def document_array=(documents)
  self.documentation_attributes = documents.collect{|i, file| { document_attributes: {document_file: file}}}
end

#documented?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'app/models/concerns/shared/documentation.rb', line 19

def documented?
  documentation.any?
end

#reject_documentation(attributed) ⇒ Object (protected)

Not tested!



30
31
32
# File 'app/models/concerns/shared/documentation.rb', line 30

def reject_documentation(attributed)
  attributed['document_attributes'].blank? ||  attributed['document_attributes']['document_file'].blank?
end

#reject_documents(attributed) ⇒ Object (protected)



34
35
36
# File 'app/models/concerns/shared/documentation.rb', line 34

def reject_documents(attributed)
  attributed['document_file'].blank? 
end