Ticket #305 (new defect)
Name/Alias Bug in scaffold view.xsl
| Reported by: | otupman | Owned by: | somebody |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.0.x-next-patch |
| Version: | 2.0.304 | Severity: | normal |
| Keywords: | Cc: |
Description
I believe there to be a bug in the view.xsl for scaffolding. If I have the following Reactor XML:
<object name="project"> <hasOne name="customer"> <relate to="id" from="customerId"/> </hasOne> </object>
The customer object has a name field. When attempting to view the project object, an exception is thrown that the method 'getName()' cannot be found on 'targetObject'.
Looking into the view.xsl code it appears that the view.xsl script assigns the project record's customerId value via getCustomerID() rather than accessing the getCustomer() method:
<cfset targetObject = <xsl:value-of select="/object/alias"/> Record.get<xsl:value-of select="name"/>() />
I believe that it should read
<cfset targetObject = <xsl:value-of select="/object/alias"/> Record.get<xsl:value-of select="alias"/>() />
Where the value used is alias rather than name (alias will refer, I think, to the object's name in the ORM rather than table or field name). Note that the line above is in a block of four, all of which reference name rather than alias and all would need changing.
The view.xsl file also seems to output an extra closing div tag, which completely mucks up my div-based site :D
I've attached my modified view.xsl file that works.
![(please configure the [header_logo] section in trac.ini)](/ModelGlue.com/trac.cgi/chrome/site/your_project_logo.png)