Im new to ROR but i started prior to ROR 2.02. I spent a lot of time with the Depot app from "Agile web development 2nd" then upgraded to 2.02 and have learned alot getting the Depot app to work. the app works well exept for in the following condition: -------From the edit view (app/views/admin) <% form_tag :action => ''update'',:id => @product do %> <%= render :partial => ''form'' %> <%= submit_tag "Update" %> -------should envoke the update action in the admin_controller def update @product = Product.find(params[:id]) if @product.update_attributes(params[:product]) flash[:notice] = ''Product was successfully updated.'' redirect_to :action => ''show'', :id => @product else render :action => ''edit'' end end ------UnknownAction (No action responded to 1): it looks like the :id is getting set in place of the action. Here is the log Processing AdminController#1 (for 127.0.0.1 at 2008-01-31 23:35:31) [POST] Session ID: BAh7CDoMdXNlcl9pZGkGOgljYXJ0bzoJQ2FydAY6C0BpdGVtc1sAIgpmbGFz %0AaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpA %0AdXNlZHsA--a63cf499f342a8eddf7aff208c4e2824f8df4886 Parameters: {"commit"=>"Update", "product"=>{"image_url"=>"/images/ auto.jpg", "title"=>"Pragmatic Project Automation", "price"=>"29.9", "description"=>"Pragmatic Project Automation</em> shows you how to improve the consistency and repeatability of your project''s procedures using automation to reduce risk and errors.\r\n\r\nSimply put, we''re going to put this thing called a computer to work for you doing the mundane (but important) project stuff. That means you''ll have more time and energy to do the really exciting---and difficult---stuff, like writing quality code."}, "action"=>"1", "controller"=>"admin"} [4;35;1mUser Load (0.000275) [0m [0mSELECT * FROM users WHERE (users."id" = 1) LIMIT 1 [0m ActionController::UnknownAction (No action responded to 1): --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Bigg
2008-Feb-01 08:01 UTC
Re: ActionController::UnknownAction (No action responded to 1):
You need to specify a :method => "put" into your form_tag. It should also be form_for(@product) which should do all that url stuff for you. On Feb 1, 2008 3:42 PM, juano <jfsadder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Im new to ROR but i started prior to ROR 2.02. I spent a lot of time > with the Depot app from "Agile web development 2nd" then upgraded to > 2.02 and have learned alot getting the Depot app to work. > the app works well exept for in the following condition: > > -------From the edit view (app/views/admin) > > <% form_tag :action => ''update'',:id => @product do %> > <%= render :partial => ''form'' %> > <%= submit_tag "Update" %> > > -------should envoke the update action in the admin_controller > > def update > @product = Product.find(params[:id]) > if @product.update_attributes(params[:product]) > flash[:notice] = ''Product was successfully updated.'' > redirect_to :action => ''show'', :id => @product > else > render :action => ''edit'' > end > end > > ------UnknownAction (No action responded to 1): > it looks like the :id is getting set in place of the action. Here is > the log > > Processing AdminController#1 (for 127.0.0.1 at 2008-01-31 23:35:31) > [POST] > Session ID: > BAh7CDoMdXNlcl9pZGkGOgljYXJ0bzoJQ2FydAY6C0BpdGVtc1sAIgpmbGFz > %0AaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpA > %0AdXNlZHsA--a63cf499f342a8eddf7aff208c4e2824f8df4886 > Parameters: {"commit"=>"Update", "product"=>{"image_url"=>"/images/ > auto.jpg", "title"=>"Pragmatic Project Automation", "price"=>"29.9", > "description"=>"Pragmatic Project Automation</em> shows you how to > improve the consistency and repeatability of your project''s procedures > using automation to reduce risk and errors.\r\n\r\nSimply put, we''re > going to put this thing called a computer to work for you doing the > mundane (but important) project stuff. That means you''ll have more > time and energy to do the really exciting---and difficult---stuff, > like writing quality code."}, "action"=>"1", "controller"=>"admin"} > [4;35;1mUser Load (0.000275) [0m [0mSELECT * FROM users WHERE > (users."id" = 1) LIMIT 1 [0m > > > ActionController::UnknownAction (No action responded to 1): > > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
juano
2008-Feb-01 13:46 UTC
Re: ActionController::UnknownAction (No action responded to 1):
could you give me an example of the :metohod => "put" i tried to set it up as form_for(@product) app/views/admin/edit.html.erb <h1>Editing product</h1> <% form_for(@product) do |f|%> <%= render :partial => ''form'' %> <%= f.submit "Update" %> <% end %> <%= link_to ''Show'', :action => ''show'', :id => @product %> | <%= link_to ''Back'', :action => ''index'' %> NoMethodError in Admin#edit Showing admin/edit.html.erb where line #11 raised: undefined method `product_path'' for #<ActionView::Base:0x22cd024> Extracted source (around line #11): 8: --> 9: <h1>Editing product</h1> 10: 11: <% form_for(@product) do |f|%> 12: <%= render :partial => ''form'' %> 13: <%= f.submit "Update" %> 14: RAILS_ROOT: /Users/juano/code/DepotX Application Trace | Framework Trace | Full Trace /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/polymorphic_routes.rb:27:in `send!'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/polymorphic_routes.rb:27:in `polymorphic_url'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/polymorphic_routes.rb:31:in `polymorphic_path'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/ helpers/form_helper.rb:200:in `apply_form_for_options!'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/ helpers/form_helper.rb:179:in `form_for'' app/views/admin/edit.html.erb:11:in `_run_erb_47app47views47admin47edit46html46erb'' Request Parameters: {"id"=>"1"} Show session dump Response Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"} On Feb 1, 3:01 am, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You need to specify a :method => "put" into your form_tag. > > It should also be form_for(@product) which should do all that url stuff for > you. > > On Feb 1, 2008 3:42 PM, juano <jfsad...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > Im new to ROR but i started prior to ROR 2.02. I spent a lot of time > > with the Depot app from "Agile web development 2nd" then upgraded to > > 2.02 and have learned alot getting the Depot app to work. > > the app works well exept for in the following condition: > > > -------From the edit view (app/views/admin) > > > <% form_tag :action => ''update'',:id => @product do %> > > <%= render :partial => ''form'' %> > > <%= submit_tag "Update" %> > > > -------should envoke the update action in the admin_controller > > > def update > > @product = Product.find(params[:id]) > > if @product.update_attributes(params[:product]) > > flash[:notice] = ''Product was successfully updated.'' > > redirect_to :action => ''show'', :id => @product > > else > > render :action => ''edit'' > > end > > end > > > ------UnknownAction (No action responded to 1): > > it looks like the :id is getting set in place of the action. Here is > > the log > > > Processing AdminController#1 (for 127.0.0.1 at 2008-01-31 23:35:31) > > [POST] > > Session ID: > > BAh7CDoMdXNlcl9pZGkGOgljYXJ0bzoJQ2FydAY6C0BpdGVtc1sAIgpmbGFz > > %0AaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpA > > %0AdXNlZHsA--a63cf499f342a8eddf7aff208c4e2824f8df4886 > > Parameters: {"commit"=>"Update", "product"=>{"image_url"=>"/images/ > > auto.jpg", "title"=>"Pragmatic Project Automation", "price"=>"29.9", > > "description"=>"Pragmatic Project Automation</em> shows you how to > > improve the consistency and repeatability of your project''s procedures > > using automation to reduce risk and errors.\r\n\r\nSimply put, we''re > > going to put this thing called a computer to work for you doing the > > mundane (but important) project stuff. That means you''ll have more > > time and energy to do the really exciting---and difficult---stuff, > > like writing quality code."}, "action"=>"1", "controller"=>"admin"} > > [4;35;1mUser Load (0.000275) [0m [0mSELECT * FROM users WHERE > > (users."id" = 1) LIMIT 1 [0m > > > ActionController::UnknownAction (No action responded to 1): > > -- > Ryan Bigghttp://www.frozenplague.net > Feel free to add me to MSN and/or GTalk as this email.--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ruby Man
2008-Dec-02 18:51 UTC
Re: ActionController::UnknownAction (No action responded to 1):
To correct the error: undefined method `product_path'' for #<ActionView::Base:0x22cd024> Add this line to your routes.rb file: map.resources :products (You can see this is in the example code in the book.) -- 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 -~----------~----~----~----~------~----~------~--~---