Here's the code.
Tuesday, March 30, 2010
Adding tags to Mongoid Documents
In our latest project at Martian Interactive we are using Mongoid to support some document-based models instead of a relational approach like ActiveRecord models. As many applications, this one needed a tagging system (nothing magic, we all know there are a lot of gems/plugins out there that works pretty fine with AR) for Mongoid documents, so I ended up writting a really basic and simple tagging system that's working pretty well, since we are using a document-based schema each document has it's own set of embedded tags that are loaded when the document is required allowing us to save some queries, with a relational schema this solution wouldn't be an option due to the redundance it introduces.