Module: Shared::Tags
- Extended by:
- ActiveSupport::Concern
- Included in:
- AssertedDistribution, Attribution, BiocurationClass, BiologicalAssociation, BiologicalAssociationsGraph, BiologicalRelationship, CharacterState, Citation, CollectingEvent, CollectionObject, CollectionObjectObservation, CollectionProfile, CommonName, Container, Depiction, Descriptor, Document, Documentation, Extract, FieldOccurrence, GeneAttribute, Georeference, Image, Label, Lead, Loan, LoanItem, Note, Observation, ObservationMatrix, ObservationMatrixColumn, ObservationMatrixColumnItem, ObservationMatrixRow, ObservationMatrixRowItem, Otu, OtuRelationship, Person, PreparationType, Repository, Sequence, SequenceRelationship, Serial, SledImage, Source, SqedDepiction, TaxonName, Topic, TypeMaterial, User
- Defined in:
- app/models/concerns/shared/tags.rb
Overview
Shared code for extending data classes with Tags.
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #reject_tags(attributed) ⇒ Object private
- #tag_with(keyword_id) ⇒ Object
-
#tagged? ⇒ Boolean
True if the object has tags.
-
#tagged_with?(keyword_id) ⇒ Boolean
True if the object has a tak with this keyword.
Instance Method Details
#reject_tags(attributed) ⇒ Object (private)
67 68 69 70 71 |
# File 'app/models/concerns/shared/tags.rb', line 67 def (attributed) (attributed['keyword'].blank? && attributed['keyword_id'].blank?) && attributed['position'].blank? && attributed['keyword_attributes'].blank? end |
#tag_with(keyword_id) ⇒ Object
46 47 48 |
# File 'app/models/concerns/shared/tags.rb', line 46 def tag_with(keyword_id) << Tag.new(keyword_id:) end |
#tagged? ⇒ Boolean
Returns true if the object has tags.
36 37 38 |
# File 'app/models/concerns/shared/tags.rb', line 36 def tagged? .any? end |
#tagged_with?(keyword_id) ⇒ Boolean
Returns true if the object has a tak with this keyword.
42 43 44 |
# File 'app/models/concerns/shared/tags.rb', line 42 def tagged_with?(keyword_id) .where(keyword_id:).any? end |