# ActionController::UnknownAction (No action responded to 1):

**URL:** <https://www.ruby-forum.com/t/actioncontroller-unknownaction-no-action-responded-to-1/127773>\
**Category:** Rails\
**Created:** [February 1, 2008, 6:13am UTC](https://www.ruby-forum.com/t/actioncontroller-unknownaction-no-action-responded-to-1/127773 "2008-02-01T06:13:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![juano](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ba9def/32.png) [@juano](https://www.ruby-forum.com/u/juano)\
**Post date:** [February 1, 2008, 6:13am UTC](https://www.ruby-forum.com/t/actioncontroller-unknownaction-no-action-responded-to-1/127773/1 "2008-02-01T06:13:34Z")

</div>

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 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):

---

<div class="post-metadata">

**Author:** ![juano](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ba9def/32.png) [@juano](https://www.ruby-forum.com/u/juano)\
**Post date:** [February 1, 2008, 9:02am UTC](https://www.ruby-forum.com/t/actioncontroller-unknownaction-no-action-responded-to-1/127773/2 "2008-02-01T09:02:47Z")

</div>

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 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> \<%= submit\_tag “Update” %\>  
> end  
> %0AaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpA  
> [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 B.

> **[frozenplague.net](http://www.frozenplague.net)**
>
> This domain may be for sale!

Feel free to add me to MSN and/or GTalk as this email.

---

<div class="post-metadata">

**Author:** ![juano](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ba9def/32.png) [@juano](https://www.ruby-forum.com/u/juano)\
**Post date:** [February 1, 2008, 2:47pm UTC](https://www.ruby-forum.com/t/actioncontroller-unknownaction-no-action-responded-to-1/127773/3 "2008-02-01T14:47:38Z")

</div>

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

# Editing product

\<% 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:

# Editing product
  
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”}

---

<div class="post-metadata">

**Author:** ![juano](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ba9def/32.png) [@juano](https://www.ruby-forum.com/u/juano)\
**Post date:** [December 2, 2008, 7:51pm UTC](https://www.ruby-forum.com/t/actioncontroller-unknownaction-no-action-responded-to-1/127773/4 "2008-12-02T19:51:33Z")

</div>

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.)
