Grails
  1. Grails
  2. GRAILS-3705

Coding controller classes optional for dynamic scaffolding

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Controllers, Scaffolding
    • Labels:
      None
    • Environment:
      OS X, WIndows & Linux I guess

      Description

      I have lots of controllers coded exactly the same with just one line in each controller class, i.e. 'def scaffold = true'. It would be helpful if instead of copying and pasting controller classes containing just one line I could add that one line to my domain class instead. This would effectively be indicating that I wanted to use dynamic scaffolding for that domain class, e.g.

      class Book {

      String title
      String author

      def scaffold = true
      }

      As well as avoiding copying and pasting whole classes for just one line of identical content this would allow me to much more easily determine which controllers have meaningful code within controller classes, i.e. I could choose that only the non-dynamically scaffolded controller classes would exist.

      I envisage logic something like this,

      • Look for a controller for each domain class
      • If no controller found and and 'def dynamicScaffolding = true' then generate/use a dynamic scaffolding controller in memory

      A side benefit is that an entry-level/demo/example application would just require coding of the domain class and could be demonstrated as working code in just four steps, i.e.
      1. grails create-app
      2. grails create-domain-class
      3. edit domain class
      4. grails run app

      My proposal is that this new feature co-exists with the current dynamic scaffolding mechanism, rather than replaces it.

        Activity

        Hide
        Graeme Rocher added a comment -

        There is no scope / time to resolve these remaining lower priority issues for 1.2 so moving to 1.3

        for 1.2 final only issues considered blocking will now be fixed

        Show
        Graeme Rocher added a comment - There is no scope / time to resolve these remaining lower priority issues for 1.2 so moving to 1.3 for 1.2 final only issues considered blocking will now be fixed
        Hide
        Bobby Warner added a comment -

        It would be a bad idea to mix scaffolding statements (UI stuff) into domain classes.

        To avoid writing the scaffold line multiple times, you can have one abstract BaseController with the scaffold line and then extend this BaseController for any ones you want scaffolding.

        So, closing this issue as won't fix. Thanks, Bobby

        Show
        Bobby Warner added a comment - It would be a bad idea to mix scaffolding statements (UI stuff) into domain classes. To avoid writing the scaffold line multiple times, you can have one abstract BaseController with the scaffold line and then extend this BaseController for any ones you want scaffolding. So, closing this issue as won't fix. Thanks, Bobby

          People

          • Assignee:
            Bobby Warner
            Reporter:
            Keith Thomas
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Last Reviewed:

              Development