Plugins You can find out about all the publicly available Grails plugins.

Rateable Plugin

  • Tags: rating
  • Latest: 0.7.1
  • Last Updated: 10 January 2012
  • Grails version: 1.2 > *
13 votes
compile "org.grails.plugins:rateable:0.7.1"
Custom repositories:
mavenRepo "http://localhost:8081/artifactory/plugins-releases-local/"

 Documentation  Source  Issues


A plugin that adds a generic mechanism for rating domain objects.


Rateable Plugin

This plugin provides allows ratings to be attached to domain objects, as well as a 5-star rating component with ajax update.


  • Grails Version: 1.1 and above
  • JDK: 1.5 and above
  • YUI 2.6.1


grails install-plugin rateable


Implement the Rateable interface:

import org.grails.rateable.*

class Vehicle implements Rateable { }

On your page load the rateable resources:


Include a tag to allow users to rate:

<rateable:ratings bean='${myVehicle}'/>

Like the Commentable Plugin, to use you may need to define a rater evaluator in grails-app/conf/Config.groovy. The default one looks like:

grails.rateable.rater.evaluator = { request.user }

But if you store users in the session instead you may want this to be:

grails.rateable.rater.evaluatorr = { session.user }

The plugin also adds some useful static methods and properties to each Rateable as defined below:

Static Methods
  • listOrderByAverageRating - lists all rated items by their average rating. Takes an optional Map parameter for pagination
  • countRated - Counts the number of rated items, good for pagination in combination with the above method.
  • ratings - Returns all the ratings for a given Rateable
  • averageRating - Returns the average rating of all the ratings
  • totalRatings - Returns the total number of ratings given to the Rateable
  • rate(user, Double rating) - Rates a Rateable for the given user and specified rating
  • userRating(user) - Returns the rating for the specified user