Describe the bug
When generating a scaffold using the Wheels CLI, the generated form for the edit page submits using the POST method instead of the expected PATCH or PUT.
This results in a routing error because the /posts/:id route does not accept POST for updates.
To Reproduce
Steps to reproduce the behavior:
- Generate scaffold:
wheels generate scaffold Post title:string body:text
- Start the application
- Create a post
- Open edit page:
http://localhost:2000/posts/2/edit
- Submit the form
- Observe routing error
Generated form behavior
New (works correctly):
<form action="/posts" method="post">
Edit (problematic):
<form action="/posts/2" method="post">
Error message:
Wheels.RouteNotFound
Incorrect HTTP Verb for route
The posts/2 path does not allow POST requests, only GET,PATCH,PUT,DELETE,GET requests.
Template used (_form.cfm):
#startFormTag(action=IsNumeric(post.id ?: "") ? "update" : "create", key=post.id ?: "")#
Expected behavior
- Edit form should submit using:
- PATCH or PUT (via method override or proper form configuration)
- Generated scaffold should work out-of-the-box with RESTful routes
Example expected output:
<form action="/posts/2" method="post">
<input type="hidden" name="_method" value="PATCH">
Actual behavior
- Edit form submits as plain POST
- No method override (_method) is included
- Results in route mismatch error
Desktop:
Describe the bug
When generating a scaffold using the Wheels CLI, the generated form for the edit page submits using the POST method instead of the expected PATCH or PUT.
This results in a routing error because the /posts/:id route does not accept POST for updates.
To Reproduce
Steps to reproduce the behavior:
Generated form behavior
New (works correctly):
Edit (problematic):
Error message:
Template used (_form.cfm):
Expected behavior
Example expected output:
Actual behavior
Desktop: