Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.3-M2
    • Component/s: TagLib, URL mappings
    • Labels:
      None

      Description

      Reverse lookup for a mapping like this:

      "/api/books"(controller: "book") {
          action = [GET: "apiShow", POST: "apiNew"]
      }
      

      doesn't work if you provide an 'action' attribute to any of the link generation tags. It only works if you leave 'action' out. This is pretty confusing, so it would be good if createLink(controller: "book", action: "apiNew") generated "/api/books".

      To demonstrate the issue, unpack the attached bug report, run the application, and open the home page. The two "API ..." links displayed on the page link to a different location than "/api/books".

        Issue Links

          Activity

          Hide
          cdeszaq added a comment -

          GRAILS-2843 is a specific instance of this, or is at least closely related.

          Show
          cdeszaq added a comment - GRAILS-2843 is a specific instance of this, or is at least closely related.
          Hide
          Iván López added a comment -

          I think the main problem here is because grails "enforces you" in some way to use createLink, redirect,... using controller/action values instead of using named URLs.
          I think that the default use should be creating a named URL and use it in all the application. There are only advantages:

          • Easy refactors for controllers. It is only necessary to change the action in the URL mappings file and not in all controllers and GSPs.
          • Write less code. You only write createLink(mapping:'myMapping') instead of createLink (controller:'myController',action:'myAction')

          As a final thought, in all our grails project we always use named URLs because we have leant from our previous errors in others projects.

          Show
          Iván López added a comment - I think the main problem here is because grails "enforces you" in some way to use createLink, redirect,... using controller/action values instead of using named URLs. I think that the default use should be creating a named URL and use it in all the application. There are only advantages: Easy refactors for controllers. It is only necessary to change the action in the URL mappings file and not in all controllers and GSPs. Write less code. You only write createLink(mapping:'myMapping') instead of createLink (controller:'myController',action:'myAction') As a final thought, in all our grails project we always use named URLs because we have leant from our previous errors in others projects.

            People

            • Assignee:
              Graeme Rocher
              Reporter:
              Peter Ledbrook
            • Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Last Reviewed:

                Development