I am new to grails I am trying to retrieve an id from a url. I have domains called Beer and recipe. Beer hasMany recipes and recipe belongsTo beer. I want to create a link to a new recipe from the beer show page passing the beer id in the url.
I know I need a URL along the lines of /recipe/create?beerid=
and then apply that as a value to a form field for submission. How would I do this?
beer show
action
def show(Beer beer) {
respond beer
}
beer show.gsp
<g:link controller="recpie" action="create" resource="recipe" params="[beerid: beer.id]">Create Recipe</g:link>