How to edit an image in GRAILS Groovy loaded in the database

0

I have the following problem. I generate a Domain photos:

class Foto {

byte[] foto
String nombreFoto

  static constraints = {
        foto size: 0..1000000000
    }
}

When I generate the controller and views with grails, and I raise the app. After saving an image, the same perform the save () method without problems.

My problem is when I request to edit that entry, and I select a new photo. By hitting the "EDIT" button, it takes me to a view that does not exist and does not generate any error of any kind, that is, the image or even the other attributes are updated.

the error is a 405.

I have not modified any method, or any view, leaving everything as default as grails do with the generate-all.

    
asked by NicoGenesio 02.04.2016 в 21:25
source

1 answer

0

The solution to the problem is to make a POST instead of a PUT in the update method of our controller and simply declare it as follows:

static allowedMethods = [save: "POST", update: "POST", delete: "DELETE"]
    
answered by 06.04.2016 / 14:29
source