Skip to content

Instantly share code, notes, and snippets.

@bryanchug
Created October 11, 2012 09:30
Show Gist options
  • Save bryanchug/3871241 to your computer and use it in GitHub Desktop.
Save bryanchug/3871241 to your computer and use it in GitHub Desktop.
Grails Console Filter
consoleImports(controller: 'console', action: '*') {
before = {
String importStatements = """
// Groovy Code here
// Implicit variables include:
// ctx: the Spring application context
// grailsApplication: the Grails application
// config: the Grails configuration
// request: the HTTP request
// session: the HTTP session
// Shortcuts:
// Execute: Ctrl-Enter
// Clear: Esc
import com.adapp.domain.*
"""
session['_grails_console_last_code_'] = session['_grails_console_last_code_'] ?: importStatements
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment