Module: Shared::Depictions

Extended by:
ActiveSupport::Concern
Included in:
CollectingEvent, CollectionObject, CollectionObjectObservation, Loan, Otu, TaxonName
Defined in:
app/models/concerns/shared/depictions.rb

Overview

Shared code for extending data-classes with Depictions.

Instance Method Summary (collapse)

Instance Method Details

- (Boolean) has_depictions?

Returns:

  • (Boolean)


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

def has_depictions?
  self.depictions.size > 0
end

- (Object) image_array=(images)



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

def image_array=(images)
  self.depictions_attributes = images.collect{|i, file| { image_attributes: {image_file: file}}}
end

- (Object) reject_depictions(attributed) (protected)

Not tested!



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

def reject_depictions(attributed)
  attributed['image_attributes'].blank? ||  attributed['image_attributes']['image_file'].blank?
end

- (Object) reject_images(attributed) (protected)



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

def reject_images(attributed)
  attributed['image_file'].blank? 
end