I have been trying to do my own edit form and it keeps saying I have a missing template update.rhtml. Here is my controller code: def edit @client = Client.find(params[:id]) end def update @client = Client.find(params[:id]) if @client.save flash[:notice] = ''Profile updated!'' else render :action => ''edit'' end end Here is my edit.rhtml code: </head> <body> <form method="POST" action="update/<%= @client.id %>" > <input type="hidden" id="client_id" name="client[id]" value="<%@client.id %>" /> <h1>Editing <%= @client.username %>''s profile</h1> <br/> <p><b>Username: </b><%= @client.username %></p> <p><b>Password: </b><input type="text" id="client_password" name="client[password]" value="<%= @client.password %>" /></p> <p><b>First Name: </b><input type="text" id="client_firstname" name="client[firstname]" value="<%= @client.firstname %>" /></p> <p><b>Last Name: </b><input type="text" id="client_lastname" name="client[lastname]" value="<%= @client.lastname %>" /></p> <p><b>Email: </b><input type="text" id="client_email" name="client[email]" value="<%= @client.email %>" /></p> <p><b>IP: </b><%= @client.ip %></p> <p><b>Date Registered: </b> <%= @client.dateIN %></p> <input type="submit" id="editSubmit" value="Update" /> </form> </body> </html> Why wont'' it accept my update? Thanks, -M -- 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 -~----------~----~----~----~------~----~------~--~---
What does your update.rhtml file look like? -- 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 -~----------~----~----~----~------~----~------~--~---
Steve Murdoch wrote:> What does your update.rhtml file look like?I shouldn''t have to make an update.rhtml file, I should only have to create the edit.rhtml file. Its the same thing as new and create. You only need to create the new.rhtml file but you don''t need to create the create.rhtml file. -- 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 -~----------~----~----~----~------~----~------~--~---
Your update does not redirect back to edit, thus you are getting the error. If you don''t tell the controller to render or redirect explicitly, it will render whatever template matches the name of the action. def update @client = Client.find(params[:id]) if @client.save flash[:notice] = ''Profile updated!'' else render :action => ''edit'' end end Should be def update @client = Client.find(params[:id]) if @client.save flash[:notice] = ''Profile updated!'' redirect_to :action=>"edit", :id=>@client else render :action => ''edit'' end end On 7/19/07, Matthew Lagace <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Steve Murdoch wrote: > > What does your update.rhtml file look like? > > I shouldn''t have to make an update.rhtml file, I should only have to > create the edit.rhtml file. Its the same thing as new and create. You > only need to create the new.rhtml file but you don''t need to create the > create.rhtml file. > > -- > 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 -~----------~----~----~----~------~----~------~--~---