Module: Shared::Depictions

Extended by:
ActiveSupport::Concern
Included in:
BiologicalAssociation, CharacterState, CollectingEvent, CollectionObject, CollectionObjectObservation, Container, Content, Descriptor, FieldOccurrence, Label, Lead, Loan, Observation, Otu, Person, TaxonDetermination, 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

#has_depictions?Boolean

Returns:

  • (Boolean)


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

def has_depictions?
  self.depictions.size > 0
end

#image_array=(images) ⇒ Object



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

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

#reject_depictions(attributed) ⇒ Object (protected)



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

def reject_depictions(attributed)
  attributed['image_id'].blank? && !attributed['images_attributes'].nil?
end

#reject_images(attributed) ⇒ Object (protected)



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

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