Restricting Messages to an Event

Since we want the messages to constitute a forum for a given event, we’ll have to modify the scaffolded views to limit the viewing and creating of TekMessage instances to the TekEvent they relate to. It’s important to note that the relationship between TekEvent and TekMessage is already established in the domain model; we’re just going to make the workflow match that relationship.

We’ll start by modifying the event show view. We’re going to add a single “Messages” hyperlink that will lead to the message list view, and we are going to filter the list to show only those TekMessage instances that are related to the TekEvent.

Open TekDays/grails-app/views/tekEvent/show.gsp, and add the following code below the ...

Get Grails 2: A Quick-Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.