Search code examples
grailsgrails-controller

grails.rest.RestfulController. How to add a parameter in the UrlMappings?


How to add a parameter in the UrlMappings, without overriding the update?

    "/hospitalReferral/admission/$id?"(controller:'hospitalReferral'){
        action = [PUT:"update"]
        admissionDate = new Date().format("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") //controller does not see this parameter
     }

Solution

  • This works for me with Grails 2.4.2

    "/hospitalReferral/admission/$id?"(controller: 'hospitalReferral', action: 'update', method: 'PUT') {
        admissionDate = new Date().format("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
    }