Created
October 24, 2009 05:56
-
-
Save nobeans/217388 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/grails/src/grails/grails-app/conf/Config.groovy b/grails/src/grails/grails-app/conf/Config.groovy | |
index 63ef42d..0981d5f 100644 | |
--- a/grails/src/grails/grails-app/conf/Config.groovy | |
+++ b/grails/src/grails/grails-app/conf/Config.groovy | |
@@ -35,6 +35,9 @@ grails.enable.native2ascii = true | |
// enable GSP preprocessing: replace head -> g:captureHead, title -> g:captureTitle, meta -> g:captureMeta, body -> g:captureBody | |
grails.views.gsp.sitemesh.preprocess = true | |
+// templates configuration | |
+grails.templates.domainSuffix = 'Instance' | |
+ | |
// set per-environment serverURL stem for creating absolute links | |
environments { | |
production { | |
diff --git a/grails/src/java/org/codehaus/groovy/grails/scaffolding/DefaultGrailsTemplateGenerator.groovy b/grails/src/java/org/codehaus/groovy/grails/scaffolding/DefaultGrailsTemplateGenerator.groovy | |
index 5b6837d..a0a1499 100644 | |
--- a/grails/src/java/org/codehaus/groovy/grails/scaffolding/DefaultGrailsTemplateGenerator.groovy | |
+++ b/grails/src/java/org/codehaus/groovy/grails/scaffolding/DefaultGrailsTemplateGenerator.groovy | |
@@ -30,6 +30,7 @@ import org.springframework.core.io.FileSystemResource | |
import org.springframework.core.io.ResourceLoader | |
import org.springframework.core.io.support.PathMatchingResourcePatternResolver | |
import org.codehaus.groovy.grails.cli.CommandLineHelper | |
+import org.codehaus.groovy.grails.commons.ConfigurationHolder | |
/** | |
* Default implementation of the generator that generates grails artifacts (controllers, views etc.) | |
@@ -212,7 +213,11 @@ class DefaultGrailsTemplateGenerator implements GrailsTemplateGenerator, Resourc | |
} | |
private def getPropertyName(GrailsDomainClass domainClass) { | |
- return domainClass.propertyName + 'Instance' | |
+ def suffix = ConfigurationHolder.config.grails.templates?.domainSuffix | |
+ if (suffix == [:]) { // default for compatibility | |
+ suffix = 'Instance' | |
+ } | |
+ return domainClass.propertyName + suffix | |
} | |
private helper = new CommandLineHelper() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment