Bootstrapping Some Test Data
To get a better feel for how TekDays is coming along, we can enter some data and check out the various views. We’ve seen the list and create views, but there’s also the show and edit views.
The problem with entering test data now is that it would all be lost as soon as we restarted the application. We’re working with an in-memory database at this point. Eventually, we will point TekDays at a real database, but for now, the in-memory H2 database is pretty handy—that is, it would be if we didn’t lose our data.
This dilemma’s answer is in TekDays/grails-app/conf/BootStrap.groovy. The file has an init code block, which is executed by our application at start-up. If we create TekEvent instances there, they will be ...
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.