Acts As Taggable Plugin

ActsAsTaggable Plugin

It add the acts_as_taggable ability to domain class.

The domain class just implement the Taggable interface, then it has the methods below:

class Book implements Taggable
{ ... }

def book = new Book()
...
book.addTag( "java")
book.addTag( "groovy")
book.addTag( "grails")

assertEquals( "java groovy grails", book.tags)

book.removeTag( "groovy")

assertEquals( "java grails", book.tags)

book.tags = "java groovy"
book.removeTag("java")

assertEquals( "groovy", book.tags)

The source repository is http://code.google.com/p/grailsactsastaggable/

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Dec 21, 2007

    Dmitriy Kopylenko says:

    Great to see the beginning of this plugin! Much needed for web 2.0 projects....

    Great to see the beginning of this plugin! Much needed for web 2.0 projects. I'd like to suggest the following additions/refinements:

    1) The ability to track particular user's tags e.g. taggable.addTag(tag,userId)

    2) The ability to query for Taggables  by  a)  tag name b)  tag name and particular user e.g. Taggable.findAllByTag(tagName) and Taggable.findAllByTagAndUser(tagName, userId)

    3) Expose Tagging for easy tag clouds calculations. For example the following methods would return Map instances with tag counts keyed by tag name:

    * Tagging.getCountsForAllTags()

    * Tagging.getCountsForAllTagsFor(userId)