Class: Taggable
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Taggable
- Defined in:
- lib/needle_in_a_haystack/concerns/taggable.rb
Overview
This model represents an entity that can be tagged with HaystackTags through HaystackTaggings.
Instance Method Summary collapse
- #add_haystack_marker(marker) ⇒ Object
- #add_haystack_tag(key, value) ⇒ Object
- #add_multiple_tags(tags_hash) ⇒ Object
Instance Method Details
#add_haystack_marker(marker) ⇒ Object
6 7 8 9 10 |
# File 'lib/needle_in_a_haystack/concerns/taggable.rb', line 6 def add_haystack_marker(marker) self. ||= {} self.[marker] = true save! end |
#add_haystack_tag(key, value) ⇒ Object
12 13 14 15 16 |
# File 'lib/needle_in_a_haystack/concerns/taggable.rb', line 12 def add_haystack_tag(key, value) self. ||= {} self.[key] = value save! end |
#add_multiple_tags(tags_hash) ⇒ Object
18 19 20 21 22 |
# File 'lib/needle_in_a_haystack/concerns/taggable.rb', line 18 def () self. ||= {} self..merge!() save! end |