What do you do in this case?

hi, usually what do you do when you have for example to edit a user? do
you create an action edit which show the form when there’s a get request
and update the object in the db when is a post, or do you create 2
action: edit that show the form and update which is called from the edit
view?
and why do you use it instead of the other method?

Assume you have a list of users, and you have a button labeled
‘Edit’. The action associated with the ‘Edit’ button would be to
‘show’ the selected user from the list, as in /users/show/1. The
user’s data would be displayed in an editable form and would have a
post action of ‘update’, as in /users/update/1. We typically follow
this method to be RESTful in our approach to development of these
type controller / model interactions.

Steven


Steven S., CEO, FiveRuns
http://www.fiveruns.com

On 1/16/07, daniel [email protected] wrote:

hi, usually what do you do when you have for example to edit a user? do
you create an action edit which show the form when there’s a get request
and update the object in the db when is a post, or do you create 2
action: edit that show the form and update which is called from the edit
view?
and why do you use it instead of the other method?

Here’s one idea: http://errtheblog.com/post/10

Some good discussion in the comments, as well.


Chris W.
http://errtheblog.com

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs