grails - BootStrap.groovy content doesn't update the content -
i'm new grails , study via infoq's "getting started grails" book. running through i've faced problem bootstrap.groovy file:
- i've edited book says.
- run-app - , data i've entered bootstrap.groovy has been shown.
- i've updated bootstrapping values not changed. no errors shown in console.
what i've tried:
- exchanging def's places;
- set runner's class value nullables;
- changed .save(failonerror:true) .save(flush:true).
even after i've changed race class' bootstrapping values looks hasn't been changed.
looks value taken somewhere else bootstrap.groovy?
i use grails 2.2.1 postgresql db. classes' code below:
package racetrack class runner { static constraints = { firstname(blank:false) lastname(blank:false) dateofbirth(nullable:true) gender(inlist:["m","f"]) address(nullable:true) city(nullable:true) state(nullable:true) zipcode(nullable:true) email(email:true) } static hasmany = [registrations:registration] /*static mapping = { sort "email" }*/ string firstname string lastname date dateofbirth string gender string address string city string state string zipcode string email string tostring(){ "${firstname} ${lastname} (${email})" } }
and
package racetrack class bootstrap { def init = { servletcontext -> def begun = new runner(firstname:"marathon", lastname:"runner", dateofbirth:"", gender:"m", address:"", city:"", state:"", zipcode:"", email:"me@me.ru" ) begun.save(flush:true) def zabeg = new race(name:"run spb", startdate:new date() + 360*30, city:"moscow", state:"moscow", cost:10.0, distance:42.0, maxrunners:10) zabeg.save(flush:true) } def destroy = { } }
edit: happening due generate-*
scripts been run?
race.groovy:
package racetrack class race { static hasmany = [registrations:registration] string name date startdate string city string state bigdecimal distance bigdecimal cost integer maxrunners static constraints = { name(blank:false, maxsize:50) startdate(validator: { return (it >= new date()) } ) city() state(inlist:["moscow", "volgograd", "spb", "nn"]) distance(min:0.0) cost(min:0.0, max:100.0) maxrunners(min:0, max:100000) } static mapping = { sort "startdate" } bigdecimal inmiles(){ return distance*0.6214 } string tostring(){ return "${name}, ${startdate.format('mm/dd/yyyy')}" } }
bootstrap
should in grails-app/conf
instead. refer this.
Comments
Post a Comment