kofhearts
kofhearts

Reputation: 3794

Putting groovy gorm code in config file error?

I am using this, Saving-User-last-login-Time-in-Grails, simple tutorial to add lastLoginTime to User. So, everytime a user logs in, the last signed in date/time is saved to database. I followed the steps, provided in the tutorial, exactly. But end-up getting this error.

No signature of method: groovy.util.ConfigObject.withTransaction() is applicable for argument types: (Config$_run_closure3_closure11) values: [Config$_run_closure3_closure11@12fab25]

Looks like the Gorm code, in Config.groovy file, is not respected. Does anyone know, where else should I move the code to solve this problem?

Any help is much appreciated. Thanks.

Upvotes: 0

Views: 43

Answers (1)

Adeel Ansari
Adeel Ansari

Reputation: 39907

Try application.groovy, instead. For details, refer registeringCallbackClosures.

For more insight, and other approaches to achieve similar behaviour, see Events.

Upvotes: 1

Related Questions