Skip to content

Instantly share code, notes, and snippets.

@jmccaffrey42
Created November 8, 2011 02:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmccaffrey42/1346840 to your computer and use it in GitHub Desktop.
Save jmccaffrey42/1346840 to your computer and use it in GitHub Desktop.
// domain/myapp/Recipe.groovy
package myapp;
class Recipe {
String name
static constraints = {
}
}
// domain/myapp/Ingredient.groovy
package myapp;
class Ingredient {
String name
}
// controllers/myapp/RecipesController.groovy
package myapp
class RecipesController {
def index = {
def recipes = Recipe.findAll()
return [ recipes: recipes ]
}
def show = {
String id = params.id
def recipe = Recipe.get(id)
return [ recipe: recipe ]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment