Module: Shared::Documentation

Extended by:
ActiveSupport::Concern
Included in:
CharacterState, CollectingEvent, Descriptor, Loan, ObservationMatrix, 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



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

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

#documented?Boolean

Returns:

  • (Boolean)


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

def documented?
  documentation.any?
end

#reject_documentation(attributed) ⇒ Object (protected)

Not tested!



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

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

#reject_documents(attributed) ⇒ Object (protected)



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

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