Grails

create-domain-class and generate-* don't enforce naming conventions for multiple capitol letters in a row

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.0.1
  • Fix Version/s: None
  • Component/s: Persistence, Scaffolding
  • Labels:
    None
  • Environment:
    Microsoft Windows XP,
    Java 1.6.0,
    Grails 1.0.1

Description

If you run create-domain-class with an all lowercase name, it automatically capitalizes the first letter, however if you try creating a domain class that starts with more than one capitol letter in a row, such as an acronym, it creates the domain class as you specified, generate-all will create controllers and views with the same capitalization, and when you try to use those controllers, you will get a 404 Error.

An example:
======================================> Grails Command Line
[C:\LoginTest]
grails:\>create-domain-class TLAcronym

Welcome to Grails 1.0.1 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: C:\GRAILS~1.1\grails

Base Directory: C:\LoginTest
Environment set to development
Running script C:\GRAILS~1.1\grails\scripts\CreateDomainClass.groovy
[copy] Copying 1 file to C:\LoginTest\grails-app\domain
Created for TLAcronym
[copy] Copying 1 file to C:\LoginTest\test\integration
Created Tests for TLAcronym
[C:\LoginTest]
grails:\>generate-all TLAcronym

Welcome to Grails 1.0.1 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: C:\GRAILS~1.1\grails

Base Directory: C:\LoginTest
Environment set to development
Running script C:\GRAILS~1.1\grails\scripts\GenerateAll.groovy
[groovyc] Compiling 3 source files to C:\Documents and Settings\lwright\.grail
s\1.0.1\projects\LoginTest\classes
Loading with installed plug-ins: ["acegi"] ...
[0] spring.GrailsWebApplicationContext Refreshing org.codehaus.groovy.grails.com
mons.spring.GrailsWebApplicationContext@15dc721: display name [org.codehaus.groo
vy.grails.commons.spring.GrailsWebApplicationContext@15dc721]; startup date [Wed
Feb 27 14:43:47 EST 2008]; root of context hierarchy
[0] spring.GrailsWebApplicationContext Bean factory for application context [org
.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext@15dc721]: org
.springframework.beans.factory.support.DefaultListableBeanFactory@1e35ecd
Generating views for domain class TLAcronym ...
Generating controller for domain class TLAcronym ...
Finished generation for domain class TLAcronym
[C:\LoginTest]
grails:\>run-app
<=============================================

http://localhost/LoginTest/
contains a link to "TLAcronymController" (http://localhost:9091/LoginTest/TLAcronym) that returns Error: 404 NOT_FOUND, and no permutation of capitalizing TLAcronym works.

Activity

Hide
Tom Jenkins added a comment -

I've seen this also. We have a legacy application that has tables/classes with multiple capital letters at the beginning. I noticed that during generation of the view, the directories are not properly cased. For example a domain of APlan, generate the controller and views would give a structure of:
grails-app

  • views
  • APlan
    create.gsp
    delete.gsp
    edit.gsp
    list.gsp
Show
Tom Jenkins added a comment - I've seen this also. We have a legacy application that has tables/classes with multiple capital letters at the beginning. I noticed that during generation of the view, the directories are not properly cased. For example a domain of APlan, generate the controller and views would give a structure of: grails-app
  • views
  • APlan create.gsp delete.gsp edit.gsp list.gsp

People

Vote (1)
Watch (2)

Dates

  • Created:
    Updated:
    Last Reviewed: