Created
May 22, 2014 13:12
-
-
Save olivermt/383665ed62c7d00afe4a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def save() { | |
def item = new Page(params) | |
if(item.validate()) { | |
item.save(flush:true) | |
respond item | |
} | |
else { | |
render(status: 422, item.errors as JSON) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Error 2014-05-22 15:12:03,762 [http-bio-8080-exec-1] ERROR errors.GrailsExceptionResolver - PSQLException occurred when processing request: [POST] /api/page - parameters: | |
content: asjdajhdlaslkjdha | |
title: foo | |
pageName: tech | |
secured: 1 | |
ERROR: duplicate key value violates unique constraint "page_page_name_key" | |
Detail: Key (page_name)=(tech) already exists.. Stacktrace follows: | |
Message: ERROR: duplicate key value violates unique constraint "page_page_name_key" | |
Detail: Key (page_name)=(tech) already exists. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package no.cipr.safari.auxiliary | |
class Page { | |
String pageName, title, content | |
Boolean secured | |
static constraints = { | |
pageName(unique: true, blank: false) | |
title(blank: false) | |
content(blank: false) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment