Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Behavioral differences between RESTful rails and express-resource #40

Closed
supr opened this Issue · 7 comments

3 participants

@supr

When i create a restful scaffold in rails like

GET /resource/:id/edit i am greeted with a form that does a POST to /resource/:id.
But for a similar resource if i post to /resource/:id from the /resource/:id/edit form i get a Cannot POST. If this is unavailable how can a web-application update a resource via HTML form.

Thanks

@tj
Owner
tj commented

why post to /resource/:id when you have no id? letting the client determine the id is not safe, so we have POST /resource

@supr

My understanding is that posting to /resource is for create and not update. I can try to check for the id in body and maybe update the resource that way. But, i am looking for a cleaner way to do that

@tj
Owner
tj commented

yeah create == POST /video update == PUT /video/:id

@pvencill

@visionmedia I think he means that HTML(4) forms can't do a PUT operation.

@supr: Express recognizes the method override param, so you can add into your form. Unless I'm mistaken, your form method should still be a POST to /resource/:id unless you're writing for clients that support PUT (in whcih case it'd be a PUT to /resource/:id.

@supr

@pvencill Yes, the inability of HTML to PUT to a resource is what i am interested in.

@tj
Owner
tj commented

use methodOverride() + _method

@supr

Thanks.

@supr supr closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.