Grails scaffolding improvement

August 27th, 2008 by mgkimsal Leave a reply »

I put together a small change to Grails’ scaffolding templates to help with one to many and many to many relationships.  Grails (well, GORM really) will manage these relationships under the hood, but you were always left to do the interface on your own.  This small set of file changes will give you better relationship management when you ‘generate all’ or ‘generate templates’ for you domains.

Here’s a small screenshot of what an editing screen looks like:

To use these, simply ‘grails install-templates’ in your project, replace the two files from the SVN repo (see link above) and generate away.  This only deals with editing right now, not the ‘create’ step.  That could be modified, I’m sure, I just didn’t do it (or did it but didn’t make it work right).  If you’d like to contribute to this project, let me know.

Share and Enjoy:
  • del.icio.us
  • DZone
  • Facebook
  • Reddit
  • StumbleUpon
  • Digg
  • Simpy
  • Technorati
Advertisement

8 comments

  1. Graeme Rocher says:

    Patches welcome if you want it integrated into Grails core ;-)

  2. Steve says:

    Does not successfully execute “grails generate-all”. Error was:

    Could not execute method p.
    No such property: p for class: SimpleTemplateScript1

  3. mgkimsal says:

    Steve – what version of Grails are you using?

  4. Steve says:

    1.0.3 with JSecurity 0.3-SNAPSHOT and Searchable 0.5-SNAPSHOT

  5. Emmanuel says:

    Did you get any answer for this? Looks like a many to many relationship is involved to get such an error !! Let me know some tips to solve if you were lucky enough !!

  6. Florian says:

    Steve,

    did you right-click/save the file list.gsp? Were the special characters like brackets escaped with < and >?

    I ran into the same error message and fixed it with this:

    1. grails install-templates and open your src/templates/scaffolding/list.gsp

    2. browse to http://michaelkimsal.com/blog/content.php/list.gsp and copy/paste the content from the scrolling text field into your list.gsp file

    3. grails generate-all

    Cheers,
    Florian

  7. Borja says:

    Hello:

    The link doesn’t work now. I’m very interested in this, would you help me get the code, please? Have you improved it?

    Thanks

Leave a Reply