Reputation: 2476
I've been customising a template generated by the CRUD module and now need to override the save method to save the custom data from the template. I can save all the data, but when I call the render action:
render("Users/show.html", user);
I get a nullPointerException for templates object:
I'm definitely passing the correct user object through because when I run this:
System.out.println(user.toString());
//render("Users/show.html", user);
It writes my user to the console.
Any help will be much appreciated.
Play! 1.2.3
Upvotes: 4
Views: 5297
Reputation: 16439
Your controller is rendering
render("Users/show.html", user);
but the name of the element in your template is object. It should be user.
UPDATE ON COMMENT
The original templates on CRUd use "object" as an abstraction to the entity under CRUD. If you check the source code of the controller, it says:
//ignoring case when template is not found, alternative also uses object
render(type, object);
This means that there are two options:
Upvotes: 6