Acts As Taggable Plugin

  • Tags: persistence, community, tagging
  • Latest: not provided
  • Last Updated: 31 December 2009
  • Grails version: *
  • Authors: null
2 votes
Dependency:
compile ":acts-as-taggable:not provided"

Summary

Description

ActsAsTaggable Plugin

This plugin adds the RoR "acts_as_taggable" ability to domain classes.

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

class Book implements Taggable
{ … }

def book = new Book() … book.save() … 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)

Attention:

You should save the domain object before calling the addTag method, because the tag is inserted into the database when the addTag method is called. Thanks to Lucas F. A. Teixeira, who found this undocumented convention.

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

To install this plugin follow the instructions at http://code.google.com/p/grailsactsastaggable/, since it is not within the grails plugin list to install online.