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? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 Smith, CEO, FiveRuns http://www.fiveruns.com On Jan 16, 2007, at 12:39 PM, daniel 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? > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 1/16/07, daniel <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> 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 Wanstrath http://errtheblog.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---