views:

81

answers:

1

In Ruby on Rails,

http://localhost:3000/foobars/alt/1

works

but

http://localhost:3000/foobars/alt/1.xml

doesn't work.

config/route.rb is

  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'

so supposedly it supports an id.format in the URL?

+2  A: 

Ensure that your controller action has a respond to block that supports XML:

def alt
    @object = ...

    respond_to do |format|
        format.html
        format.xml { render :xml => @object.to_xml }
    end
end
Kevin Sylvestre
great, and it looks like if alt.xml.erb exists in the views folder, it would work too.
動靜能量