Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to redirect from a controller using a named URL mapping?

I have a URL mapping as below:

static mappings = {
        name register: "/register" {
            controller = "account"
            action = "createuser"
        }
}

and I want to redirect using this mapping from a controller with something like:

redirect mapping:'register'

Unfortunately, unlike createLink tag lib, it seems that redirect does not accept mapping as input parameter.

So my question is : How can I use my named URL mapping for redirection ?

like image 275
fabien7474 Avatar asked Feb 27 '23 02:02

fabien7474


1 Answers

You can combine the two:

redirect url: createLink(mapping: 'register')
like image 80
Burt Beckwith Avatar answered Mar 10 '23 02:03

Burt Beckwith