i have created new domain in grails and from a controller i’ve tried to save but nothing get saved in the database.. the code is as follow
controller
def register={
String name = params.name
String email = params.email
String pass = params.password
boolean signedIn = params.signedIn
System.out.println(name + " " + email +" "+ pass+" " + signedIn)
def rUser = new Registered(params)
rUser.signedIn = signedIn
System.out.println(rUser)
rUser.save(flush:true)
}
domain
class Registered {
String name;
String email;
String password;
boolean signedIn =false;
static constraints = {
}
}
and i’m trying to save by this url
so what am i doing wrong … putting in mind that there’s no error in the stack trace
I would start by wrapping this in an integration test that would look like this:
Then I would start by making your controller action as simple as possible:
This way you can quickly repeat your test and figure out where your problem is. Adding the
failOnError:trueto the save call will cause an exception to be thrown if it doesn’t pass validation. If this simple example works start working back towards a more elegant solution to identify where you’re issue resides.