I then took a look at source code in Castle.MonoRail.ActiveRecordSupport/Scaffold/ action files. Here's the result:
protected override string ComputeTemplateName(IControllerContext controller)
{
return controller.Name + "/list";
}
protected override string ComputeTemplateName(IControllerContext
controllerContext)
{
return controllerContext.Name + "\\create";
}
protected override string ComputeTemplateName(IControllerContext
controller)
{
return controller.Name + "\\confirm";
}
protected override string ComputeTemplateName(IControllerContext
controller)
{
return controller.Name + "\\edit";
}
protected override string ComputeTemplateName(IControllerContext
controller)
{
return String.Format(@"{0}\new{1}", controller.Name, Model.Type.Name);
}
protected override string ComputeTemplateName(IControllerContext
controller)
{
return String.Format(@"{0}\{1}removed", controller.Name,
Model.Type.Name);
}protected override string ComputeTemplateName(IControllerContext controller)
{
return controller.Name + "\\update{1}";
}
So I guess the reason why only list works is rather clear. Besides,
the failing ones still fail to use local versions instead of embedded
ones even if I name them according to the patterns given, and the
behavior is the same regardless of the OS (MacOSX and Windows XP
tested). What's more there's a bit of discreptancy here, with create
being the only one calling controllerContext.Name, some using string
concatenation, others using String.Format (both with various orders
and parameters), and update being simply broken with its remaining
placeholder.
Therefore may I suggest the simplest fix possible of naming them like the list one, unifying all of them in the process? Or did I miss something along the way?
return controller.Name + "/list";
return controller.Name + "/create";
return controller.Name + "/confirm";
return controller.Name + "/edit";
return controller.Name + "/new";
return controller.Name + "/remove";
return controller.Name + "/update";
TIA
-- Loic
smime.p7s
Description: S/MIME cryptographic signature
