Summary
startFormTag(route="customer", method="delete") throws Wheels.RouteNotFound: Could not find a 'customer' route that matched the supplied arguments. for any resource member route (GET/PATCH/PUT/DELETE), because startFormTag() resolves the named route with the rewritten HTML verb post instead of the original verb.
Repro
With resources(name="customers") configured, rendering a delete/update form:
startFormTag(route="customer", key="1", method="delete") // throws RouteNotFound
startFormTag(route="customer", key="1", method="put") // throws RouteNotFound
Root cause
view/forms.cfc:$startFormTagMethod() rewrites method from put/patch/delete to post (for the rendered <form method>), remembering the original verb only for the _method hidden field. startFormTag() then calls urlFor(argumentCollection=arguments) (and later $routeVariables(argumentCollection=arguments)) with arguments.method = "post".
The new $findRoute() disambiguation in global/routing.cfm throws when a method matches none of a same-named route's candidates. Resource member routes carry get/patch/put/delete — never post — so the lookup throws. The previous $findRoute() masked this by silently falling through to the last same-named route.
Suggested fix
Resolve the route with the ORIGINAL verb, then restore the HTML form verb before rendering:
local.method = $startFormTagMethod(args = arguments);
local.formMethod = arguments.method; // "post"/"get" (HTML verb)
if (Len(local.method)) {
arguments.method = local.method; // put/patch/delete (route verb)
}
// ... urlFor(argumentCollection=arguments) and $routeVariables(...) ...
arguments.method = local.formMethod; // restore before $tag() renders <form method="...">
Impact
Every PUT/PATCH/DELETE form on a resource member route 500s. Not covered by the current view/formsSpec.cfc/routing specs.
Summary
startFormTag(route="customer", method="delete")throwsWheels.RouteNotFound: Could not find a 'customer' route that matched the supplied arguments.for any resource member route (GET/PATCH/PUT/DELETE), becausestartFormTag()resolves the named route with the rewritten HTML verbpostinstead of the original verb.Repro
With
resources(name="customers")configured, rendering a delete/update form:Root cause
view/forms.cfc:$startFormTagMethod()rewritesmethodfromput/patch/deletetopost(for the rendered<form method>), remembering the original verb only for the_methodhidden field.startFormTag()then callsurlFor(argumentCollection=arguments)(and later$routeVariables(argumentCollection=arguments)) witharguments.method = "post".The new
$findRoute()disambiguation inglobal/routing.cfmthrows when amethodmatches none of a same-named route's candidates. Resource member routes carryget/patch/put/delete— neverpost— so the lookup throws. The previous$findRoute()masked this by silently falling through to the last same-named route.Suggested fix
Resolve the route with the ORIGINAL verb, then restore the HTML form verb before rendering:
local.method = $startFormTagMethod(args = arguments); local.formMethod = arguments.method; // "post"/"get" (HTML verb) if (Len(local.method)) { arguments.method = local.method; // put/patch/delete (route verb) } // ... urlFor(argumentCollection=arguments) and $routeVariables(...) ... arguments.method = local.formMethod; // restore before $tag() renders <form method="...">Impact
Every PUT/PATCH/DELETE form on a resource member route 500s. Not covered by the current
view/formsSpec.cfc/routing specs.