Module: Shared::Tags::ClassMethods
- Defined in:
- app/models/concerns/shared/tags.rb
Instance Method Summary collapse
-
#tagged_with_keyword(keyword) ⇒ Scope
Only those instances with tags that use the kewyord.
- #tagged_with_uri(uri) ⇒ Object
Instance Method Details
#tagged_with_keyword(keyword) ⇒ Scope
Returns only those instances with tags that use the kewyord.
45 46 47 |
# File 'app/models/concerns/shared/tags.rb', line 45 def tagged_with_keyword(keyword) joins(:tags).where(tags: {keyword:}) end |
#tagged_with_uri(uri) ⇒ Object
37 38 39 40 |
# File 'app/models/concerns/shared/tags.rb', line 37 def tagged_with_uri(uri) joins("JOIN tags t1 on t1.tag_object_type = '#{self.base_class.name}' AND t1.tag_object_id = #{self.base_class.name.tableize}.id JOIN controlled_vocabulary_terms k1 on k1.id = t1.keyword_id") .where('k1.uri = ?', uri) end |