# Help with destroy method - newbie

**URL:** <https://www.ruby-forum.com/t/help-with-destroy-method-newbie/82152>\
**Category:** Rails\
**Created:** [January 17, 2007, 8:53pm UTC](https://www.ruby-forum.com/t/help-with-destroy-method-newbie/82152 "2007-01-17T20:53:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![miked](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ed655f/32.png) [@miked](https://www.ruby-forum.com/u/miked)\
**Post date:** [January 17, 2007, 8:53pm UTC](https://www.ruby-forum.com/t/help-with-destroy-method-newbie/82152/1 "2007-01-17T20:53:14Z")

</div>

Hello:

I have a destroy method in my controller - pretty standard:

def destroy  
@goal = Goal.find(params[:id])  
respond\_to do |format|  
format.html { redirect\_to goals\_url }  
format.xml { head :ok }  
end  
end

And then I have a listing view which has the destroy method in the view

- also pretty standard:

\<%= link\_to ‘Delete’, { :action =\> ‘destroy’, :id =\> goal }, :confirm  
=\> ‘Are you sure?’, :post =\> true %\>&nbsp|&nbsp

where the id = goal id - no problem retreiving that, becuase i see it  
in my URL:

[[myurl.com](http://myurl.com)]/goals/13

but this is called, I get an error:

Unknown action

No action responded to 13

How can this be the case when the destroy method is correctly being  
referenced in my view?

Thank you very much in advance for any help you can provide.

Mike

---

<div class="post-metadata">

**Author:** ![miked](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ed655f/32.png) [@miked](https://www.ruby-forum.com/u/miked)\
**Post date:** [January 17, 2007, 9:13pm UTC](https://www.ruby-forum.com/t/help-with-destroy-method-newbie/82152/2 "2007-01-17T21:13:56Z")

</div>

It has to be url/controller\_name/action\_name/id … so in your case it  
should be like url/goals/destroy/13 … hope this helps …

---

<div class="post-metadata">

**Author:** ![miked](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ed655f/32.png) [@miked](https://www.ruby-forum.com/u/miked)\
**Post date:** [January 17, 2007, 10:25pm UTC](https://www.ruby-forum.com/t/help-with-destroy-method-newbie/82152/3 "2007-01-17T22:25:41Z")

</div>

> end  
> [[myurl.com](http://myurl.com)]/goals/13
> 
> but this is called, I get an error:
> 
> Unknown action
> 
> No action responded to 13
> 
> How can this be the case when the destroy method is correctly being  
> referenced in my view?

Look at your routes file… somewhere you have a route that is matching  
this and messing you up. Rails thinks that ‘13’ is the action.  
Something  
in your routes is making the action not get picked up.
