Dynamic scaffolding actions and view do not work while static scaffolding works

Details

Type: Bug

Status:Resolved

Priority: Major

Resolution:
Duplicate

Affects Version/s:
None

Fix Version/s:
None

Labels:

None

Environment:

JDK 5, Grails 1.1.1, Windows XP 32

Description

A scaffolding controller, that uses an action "foo" works perfectly with any view (e.g. fooView.gsp) or template (_fooView.gsp) when using static scaffolding after generating views and controller using generate-all.
When using dynamic scaffolding, the "foo"action of the controller ALWAYS wants to render a "foo.gsp"-view, so the view or template-arguments of a call to the render-method are ignored.
Dynamic and static scaffolding should always behave identically.

Issue Links

Activity

I have the same issue and think it is because of the event when a view is dynamically scaffolded.

E.g. if you have the following actions in templates\scaffolding\Controller.groovy and an existing templates\scaffolding\myaction2.gsp view:
def myaction =

{
render(view: "myaction2")
}

def myaction2 =

{
return
}

After application start, calling ../myaction will fail as the view does not exist.
After calling .../myaction2 the first time, the view is scaffolded (and cached somewhere?), and succeeding calls to ../myaction correctly show the myaction2.gsp.

If a static view (views/entity/myaction2.gsp) exists, even the first call to .../myaction is successful, as no dynamic scaffolding is needed.

The "render" function should scaffold views on the fly if they are not yet scaffoled by a controller action.

Stefan Seeger
added a comment - 16/Mar/11 7:11 PM I have the same issue and think it is because of the event when a view is dynamically scaffolded.
E.g. if you have the following actions in templates\scaffolding\Controller.groovy and an existing templates\scaffolding\myaction2.gsp view:
def myaction =
{
render(view: "myaction2")
}
def myaction2 =
{
return
}
After application start, calling ../myaction will fail as the view does not exist.
After calling .../myaction2 the first time, the view is scaffolded (and cached somewhere?), and succeeding calls to ../myaction correctly show the myaction2.gsp.
If a static view (views/entity/myaction2.gsp) exists, even the first call to .../myaction is successful, as no dynamic scaffolding is needed.
The "render" function should scaffold views on the fly if they are not yet scaffoled by a controller action.
(Version 1.3.7)