Module: Elabs::Concerns::Taggable
- Extended by:
- ActiveSupport::Concern
- Included in:
- ApplicationContentRecord
- Defined in:
- app/models/elabs/concerns/taggable.rb
Instance Method Summary collapse
- #save_tags_list ⇒ Object
-
#tags_list ⇒ Object
Returns a list of comma-separated tags.
Instance Method Details
#save_tags_list ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/models/elabs/concerns/taggable.rb', line 12 def if @tags_list = [] @tags_list.split(/, */).each do |t| .push Tag.find_or_create_by(name: t.chomp) end @tags_list = nil update(tags: ) if .count.positive? end true end |
#tags_list ⇒ Object
Returns a list of comma-separated tags
28 29 30 |
# File 'app/models/elabs/concerns/taggable.rb', line 28 def @tags_list || .map(&:name).join(', ') end |