Module: Shared::Documentation

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



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

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

- (Boolean) has_documentation?

Returns:

  • (Boolean)


17
18
19
# File 'app/models/concerns/shared/documentation.rb', line 17

def has_documentation?
  self.documentation.size > 0
end

- (Object) reject_documentation(attributed) (protected)

Not tested!



28
29
30
# File 'app/models/concerns/shared/documentation.rb', line 28

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

- (Object) reject_documents(attributed) (protected)



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

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