# Routing error with .xml

**URL:** <https://www.ruby-forum.com/t/routing-error-with-xml/145099>\
**Category:** Rails\
**Created:** [August 6, 2008, 12:39am UTC](https://www.ruby-forum.com/t/routing-error-with-xml/145099 "2008-08-06T00:39:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PeteSalty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/bc79bd/32.png) [@PeteSalty](https://www.ruby-forum.com/u/PeteSalty)\
**Post date:** [August 6, 2008, 12:39am UTC](https://www.ruby-forum.com/t/routing-error-with-xml/145099/1 "2008-08-06T00:39:43Z")

</div>

I’m trying to get a simple XML response going in one of my controllers  
so I thought it’d be as easy as adding something like

respond\_to do |format|  
format.html  
format.xml {render :xml = \> @stuff.to\_xml }  
end

to the bottom of the controller method and the default routes would  
take care of it. But instead when I try something like

[http://localhost/stuffs/list.xml](http://localhost/stuffs/list.xml)

I get a routing error saying that there’s no route for stuffs/  
list.xml.

Am I missing something here? I admit the application is not RESTful  
(it’s kind of an old app) but it is running Rails 2.0.2 and the  
default routes are set as

map.connect ‘:controller/:action/:id.:format’  
map.connect ‘:controller/:action/:id’

Anyone have this problem before?

Dale

---

<div class="post-metadata">

**Author:** ![PeteSalty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/bc79bd/32.png) [@PeteSalty](https://www.ruby-forum.com/u/PeteSalty)\
**Post date:** [August 6, 2008, 11:25pm UTC](https://www.ruby-forum.com/t/routing-error-with-xml/145099/2 "2008-08-06T23:25:56Z")

</div>

Does [http://localhost/stuffs.xml](http://localhost/stuffs.xml) work?

PeteSalty wrote:

> respond\_to do |format|  
> format.html  
> format.xml {render :xml = \> @stuff.to\_xml }  
> end
> 
> to the bottom of the controller method and the default routes would  
> take care of it. But instead when I try something like
> 
> [http://localhost/stuffs/list.xml](http://localhost/stuffs/list.xml)
