akusuma2026 opened a new issue, #14235:
URL: https://github.com/apache/grails-core/issues/14235

   Hello There,
   
   I have unidirectional Domain class in my project, List page generated with 
invalid hyperlinks. 
   `<td><a href="/parent/show/1"><a href="/child/show/1">com.sample.Child : 
1</a></a></td>`
   
   
   Steps to re-produce the issue
   
   Grails 3.3.2
   grails create-app Grails3-UniDirectional-Relationship
   grails create-domain-class com.sample.Child
   grails create-domain-class com.sample.Parent
   
   Add two properties in Child class
   package com.sample
   class Child {
       
       String name
       String description
   
       static constraints = {
       }
   }
   
   Add Child property in Parent class like below
   package com.sample
   class Parent {
   
       //Parent - to - Child (One-To-One) UniDirectional
       Child child
       static constraints = {
       }
   }
   
   Generare controllers and views
   grails generate-all com.sample.Child
   grails generate-all com.sample.Parent
   
   check: parent/index.gsp has <f:table collection="${parentList}" />
   
   Run-app
   grails run-app or Run Application.groovy
   
   Add new child
   `http://localhost:8080/child/create`
   give values for name and desctiption
   
   Add new parent
   `http://localhost:8080/parent/create`
   select a child* (created earlier) and save
   
   Now go to Parent list page
   `http://localhost:8080/parent/index`
   
   List page has Child1 Which has hyperlink of Child1 
   If you click that , it leads to `http://localhost:8080/child/show/1` instead 
of  `http://localhost:8080/parent/show/1`
   
   See view-source of Parent list page 
(`view-source:http://localhost:8080/parent/index`), 
   you will find like this
   `<td><a href="/parent/show/1"><a href="/child/show/1">com.sample.Child : 
1</a></a></td>`
   
   /parent/show/1 override by /child/show/1
   
   if we repeat this in Grails 2.4.4 or any 2.x version
   parent/index.gsp has below tag to list the values and its working fine
   `<g:each in="${parentInstanceList}" status="i" var="parentInstance"><tr 
class="${(i % 2) == 0 ? 'even' : 'odd'}"><td><g:link action="show" 
id="${parentInstance.id}">${fieldValue(bean: parentInstance, field: 
"child")}</g:link></td></tr></g:each>`
   
   
   Please suggest how can we disable or not to appear child hyperlink 
(/child/show/1). Or any fix for this in Grails 3.3.2
   
   Thanks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to