plataformatec/devise — pull request #2201 by al (2013-01-06 04:28:01+00:00)
Title: Fix bug with non-navigational requests being treated as navigational ones in XHR to SessionsController#destroy.

Ajax requests to ```SessionsController#destroy``` trigger redirects irrespective of the requested response format and ```navigational_formats``` configuration.

A typical ```Accept``` header send by a browser on an Ajax request is ```application/json,text/javascript,*/*```. If none of the preceding mime types are navigational formats then the ```*/*``` is processed, which in conjunction with XHR causes Rails to use the first response block, which as currently implemented is for navigational formats, thus triggering a redirect.

This fix simply reorders the blocks in the ```respond_to``` so that requests are only treated as navigational formats if a navigational format is explicitly requested.