I''m new to Rails, and have been reading up on it like crazy... Anyway, I built a form using render :partial, and it works fine when creating a new record, however, am having a hell of a time saving modifications to it... Here is my edit.html.erb file: Code : 1. <% form_tag :action => ''update'', :id => @score do %> 2. <%= render :partial => ''form'' %> 3. <%= submit_tag ''Edit'' %> 4. <% end %> The response that I receive from the browser is as follows: Unknown action No action responded to 10 In my controller file, I have the following: Code : 1. 2. def update 3. @score = Score.find(params[:id]) 4. if @score.update_attributes(params[:score]) 5. flash[:notice] = ''Score was successfully updated.'' 6. redirect_to scores_path 7. else 8. render :action => ''edit'' 9. end 10. end Am I missing something? Thanks! Matt -- 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 -~----------~----~----~----~------~----~------~--~---
Mathieu Manny wrote:> > Code : > > 1. > 2. def update > 3. @score = Score.find(params[:id]) > 4. if @score.update_attributes(params[:score]) > 5. flash[:notice] = ''Score was successfully updated.'' > 6. redirect_to scores_path > 7. else > 8. render :action => ''edit'' > 9. end > 10. endI think you want to say "redirect_to :action => ''scores_path''". -S -- 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 -~----------~----~----~----~------~----~------~--~---
If he''s got restful routes, he''s fine with his redirect_to... I use it all the time, like "redirect_to projects_path" What''s inside the form partial? Since edit.html.erb has a form tag, the form partial shouldn''t include a form tag, or a form_for. -- 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 -~----------~----~----~----~------~----~------~--~---
You are in not rule of your routes.rb, because the error said that cant process ID=10 I suggest you do it : 1. 2.def update 3. @score = Score.find(params[:id]) 4. respond_to do |format| 5. if @score.update_attributes(params[:score]) 6. flash[:notice] = ''Score was successfully updated.'' 7. format.html{redirect_to scores_path(@score) } 8. else 9. format.html{render :action => ''edit''} 10. end 11. end 12.end Answered on Sunday, 28-Sept-2008 By : Y Reinhart AP Blog : Teapoci.Blogspot.com -- 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 -~----------~----~----~----~------~----~------~--~---
------------------- OR ANOTHER OPTION ------------------- 1. 2.def update 3. @score = Score.find(params[:id]) 4. respond_to do |format| 5. if @score.update_attributes(params[:score]) 6. flash[:notice] = ''Score was successfully updated.'' 7. format.html{redirect_to scores_url} 8. else 9. format.html{render :action => ''edit''} 10. end 11. end 12.end I did not test them, give me update of my answers. thank you. Answered on Sunday, 28-Sept-2008 By : Y Reinhart AP Blog : Teapoci.Blogspot.com -- 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 -~----------~----~----~----~------~----~------~--~---