Last updated by
4 years ago
Page: Taggable Plugin, Version:0
Taggable Plugin
This plugin provides an alternative to the Acts as Taggable hosted at grails.org and with the following features.- Classes can be made taggable by implementing the
org.grails.taggable.Taggableinterface - Method chaining can be used to add tags
- The table name the domain classes use is customizable
Installation
grails install-plugin taggable
Usage
Implement theTaggable interface:import org.grails.taggable.*class Vehicle implements Taggable { }
def v = Vehicle.get(1)v.addTag("red") .addTag("sporty") .addTag("expensive")
def v = Vehicle.get(1) println v.tagsdef vehicles = Vehicle.findAllByTag("sporty") def count = Vehicle.countByTag("sporty")