Let's say I have two classes: News (hasMany Comment) Comment (belongsTo News)
In single news object view (news/show.gsp) I'm listing comments belonging to it after it's content. Then I want to have a form which will allow some user (but security isn't a case here) to add new comment, and then show the same (news) view again.
Seems easy, but I couldn't find the anwser: What is the proper way of doing it in Grails?
If you run
grails generate-all News
andgrails generate-all Comment
on the command-line, Grails will generate views and controller actions that allow you to CRUD each entity. If you read the generated code for thecreate
andsave
actions and views ofCommentController
, that should set you straight.