Sha256: f8bdab926d10326d724c3c0af17de2a290c3801af7851136ce5ce0e258704037
Contents?: true
Size: 370 Bytes
Versions: 3
Compression:
Stored size: 370 Bytes
Contents
module DiscoApp::Concerns::Taggable extend ActiveSupport::Concern def tags data[:tags].split(',').map(&:strip) end def add_tag(tag) data[:tags] = (tags + [tag]).uniq.join(',') end def remove_tag(tag) data[:tags] = (tags - [tag]).uniq.join(',') end def has_tag?(tag_to_check) tags.any? { |tag| tag.casecmp?(tag_to_check) } end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
disco_app-0.17.0 | app/models/disco_app/concerns/taggable.rb |
disco_app-0.18.0 | app/models/disco_app/concerns/taggable.rb |
disco_app-0.18.1 | app/models/disco_app/concerns/taggable.rb |