Module: Shared::Taggable

Extended by:
ActiveSupport::Concern
Included in:
AssertedDistribution, BiocurationClass, BiologicalRelationship, CharacterState, Citation, CollectingEvent, CollectionObject, CollectionObjectObservation, CollectionProfile, CommonName, Container, Depiction, Descriptor, Document, Documentation, GeneAttribute, Georeference, Image, Loan, LoanItem, Note, Observation, ObservationMatrix, ObservationMatrixColumn, ObservationMatrixColumnItem, ObservationMatrixRow, ObservationMatrixRowItem, Otu, PreparationType, Sequence, SequenceRelationship, Serial, Source, SqedDepiction, TaxonName, Topic, TypeMaterial, User
Defined in:
app/models/concerns/shared/taggable.rb

Overview

Shared code for extending data-classes with Tags.

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary (collapse)

Instance Method Details

- (Object) reject_tags(attributed) (protected)



50
51
52
53
54
# File 'app/models/concerns/shared/taggable.rb', line 50

def reject_tags(attributed)
  (attributed['keyword'].blank? && attributed['keyword_id'].blank?) && 
    attributed['position'].blank? && 
    attributed['keyword_attributes'].blank?   
end

- (Object) tag_with(keyword_id)



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

def tag_with(keyword_id)
  tags << Tag.new(keyword_id: keyword_id)
end

- (Boolean) tagged?

Returns:

  • (Boolean)


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

def tagged?
  tags.any?
end