History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: GRAILS-2809
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Jeff Brown
Reporter: Brian Bonner
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Grails

When there is a 1:M mapping, generate-all generates an incorrect link for the Many side of the tag

Created: 11/Apr/08 12:48 PM   Updated: 08/May/08 12:52 PM
Component/s: Scaffolding
Affects Version/s: 1.0.2
Fix Version/s: 1.0.3

Time Tracking:
Not Specified

File Attachments: 1. Text File grails2809patch.txt (1 kb)
2. Zip Archive OneManyLinkTestBad.zip (194 kb)

Environment:
Groovy Version: 1.5.4 JVM: 1.6.0-b105
Grails 1.0.2

Testcase included: yes


 Description  « Hide
Domain has a 1:M mapping: e.g. Person has many Phones.

When generating view, controller, etc. with grails generate-all The edit.gsp pages have an incorrect link tag in them for the 1 side (i.e. Person).

I've attached a test case that shows the problem and I know how to manually fix it. I just couldn't track down where the problem was occurring.

To recreate the problem, Bring up the person list (there are two people Brian and Test loaded) and choose Test. Edit Test and choose Add Phone. You'll notice that the phone has Brian selected in the drop down. It's not passing Test's id over as part of the request even though it's trying to.

Here's the code it generated:

<g:link controller="phone" params="["person.id":person?.id]" action="create">Add Phone</g:link>

if you change the double quotes around person.id to single quotes. It works AOK.

like this:

<g:link controller="phone" params="["person.id":person?.id]" action="create">Add Phone</g:link>

I hope this makes sense.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Brian Bonner - 11/Apr/08 03:00 PM
Here's the patch that addresses the problem which is in the renderEditor.template

Jeff Brown - 11/Apr/08 03:14 PM
fixed

Pam - 08/May/08 12:52 PM
Also, if you name your property anything other than the class name, the link from the edit page to the create page will break.