# Xml\_http\_request : action not found?

**URL:** <https://www.ruby-forum.com/t/xml-http-request-action-not-found/158862>\
**Category:** Rails\
**Created:** [January 28, 2009, 9:38pm UTC](https://www.ruby-forum.com/t/xml-http-request-action-not-found/158862 "2009-01-28T21:38:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![itsastickup](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/7feea3/32.png) [@itsastickup](https://www.ruby-forum.com/u/itsastickup)\
**Post date:** [January 28, 2009, 9:38pm UTC](https://www.ruby-forum.com/t/xml-http-request-action-not-found/158862/1 "2009-01-28T21:38:06Z")

</div>

I have this in a functional test:

xml\_http\_request :delete, person\_movie\_path(1,1)

and the error I get says the action cannot be found, as if the  
‘:delete’ method is not being translated to the appropriate destroy  
action. It works fine as an Ajax call from the browser.

What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![itsastickup](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/7feea3/32.png) [@itsastickup](https://www.ruby-forum.com/u/itsastickup)\
**Post date:** [January 28, 2009, 10:19pm UTC](https://www.ruby-forum.com/t/xml-http-request-action-not-found/158862/2 "2009-01-28T22:19:51Z")

</div>

Quoting itsastickup [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> I have this in a functional test:
> 
> xml\_http\_request :delete, person\_movie\_path(1,1)
> 
> and the error I get says the action cannot be found, as if the  
> ‘:delete’ method is not being translated to the appropriate destroy  
> action. It works fine as an Ajax call from the browser.

Probably wrong path. Check the URL generated by  
“person\_movie\_path(1,1)”  
against the output of “rake routes”.

HTH,  
Jeffrey

---

<div class="post-metadata">

**Author:** ![itsastickup](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/7feea3/32.png) [@itsastickup](https://www.ruby-forum.com/u/itsastickup)\
**Post date:** [January 28, 2009, 10:26pm UTC](https://www.ruby-forum.com/t/xml-http-request-action-not-found/158862/3 "2009-01-28T22:26:19Z")

</div>

> > I have this in a functional test:
> 
> > xml\_http\_request :delete, person\_movie\_path(1,1)
> 
> > and the error I get says the action cannot be found, as if the  
> > ‘:delete’ method is not being translated to the appropriate destroy  
> > action. It works fine as an Ajax call from the browser.
> 
> Probably wrong path. Check the URL generated by “person\_movie\_path(1,1)”  
> against the output of “rake routes”.

That’s what I thought but it checks out fine (I’ve practically blinded  
myself examining rake routes). I even test the route in the test  
method, and it passes. And it does work from the browser: indentical  
path (and :delete method).

The error I get is :

ActionController::UnknownAction: No action responded to /people/1/  
movies/1. Actions: create, create\_guid, lots more methods here,  
including “destroy”…

---

<div class="post-metadata">

**Author:** ![itsastickup](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/7feea3/32.png) [@itsastickup](https://www.ruby-forum.com/u/itsastickup)\
**Post date:** [January 28, 2009, 11:38pm UTC](https://www.ruby-forum.com/t/xml-http-request-action-not-found/158862/4 "2009-01-28T23:38:30Z")

</div>

Ok, so the solution seems to be to forget paths and do the test like  
this :

xml\_http\_request :delete,‘destroy’,{:id=\>1,:person\_id=\>1}
