Routing problems for different formats

Without looking at your routes and code it's really had to find a reason.

Hi Chris,

You're not doing any hacks, you're doing what's expected to tell rails
that a route will accept various formats, you should take a look at
the routes guides to undertand how the respond_to method works.

Also, to get JQuery to behave correctly without the ".js" you'll need
to add this somewhere in your application.js:

$(document).ready(function () {

        'beforeSend': function(xhr) {
            xhr.setRequestHeader("Accept", "text/javascript")


On the routes issue, as I said before, that's how it works. A route like:

map.schedule "schedule/:id", :controller => "main", :action => "schedule"

Will never call the respond_to with XML as a format unless the client
sends an "Accept: application/xml" as a header and I think you're not
doing this, so, the route with a explicit format is required, this is
no bug, that's exactly how it should behave. Also, avoid mapping URLs
directly as you're doing, these paths should be mapped using

Thanks for clearing that up Maurício.