Module: Shared::Depictions

Extended by:
ActiveSupport::Concern
Included in:
CharacterState, CollectingEvent, CollectionObjectObservation, Content, Descriptor, Label, Loan, Otu, TaxonDetermination
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)


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

def has_depictions?
  self.depictions.size > 0
end

#image_array=(images) ⇒ Object



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

#reject_depictions(attributed) ⇒ Object (protected)



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

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

#reject_images(attributed) ⇒ Object (protected)



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

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