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

- (Object) document_array=(documents)



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

- (Boolean) documented?

Returns:

  • (Boolean)


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

def documented?
  documentation.any?
end

- (Object) reject_documentation(attributed) (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

- (Object) reject_documents(attributed) (protected)



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

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