— follow @abhishiv
Almost every application benefits from having some sort of tagging functionality. For Mongoid, there’s Mongoid::Taggable, however if you have a multi-tenant application, you need to ensure tag ownership as well, making sure that tags for each tenant are kept separate. Unfortunately the awesome acts_as_taggble_on gem is tightly coupled with activerecord and doesn’t work for those of us using Mongoid.
class Organization include Mongoid::Document include ActsAsTaggable::Tagger end
class Contact include Mongoid::Document include ActsAsTaggable::Taggable end
org = Organization.last person = Person.last org.tag person, ['tag1', 'tag2']
The code is released under BSD license, so feel free to modify as you wish.