I'm using a formatted named route to create a URI:
formatted_test_url(:id => test.id, :format => :js)
Then I cache the action output:
caches_page :show
But the resulting cached file is 1.html say for test.id of 1, instead of 1.js
This is because resources.rb adds the less specific, non formatted routes before the formatted, resulting in this:
"Routes->GET /tests/:id/ {:controller=>\"tests\", :action=>\"show\"}GET /tests/:id.:format/ {:controller=>\"tests\", :action=>\"show\"}ANY /:controller/:action/:id/ {}"
If I monkey around with resources.rb & map the more specific formatted routes first, I get this:
"Routes->GET /tests/:id.:format/ {:controller=>\"tests\", :action=>\"show\"}GET /tests/:id/ {:controller=>\"tests\", :action=>\"show\"}ANY /:controller/:action/:id/ {}"
which adheres to the general specificity ordering of routes.rb (as per Changeset 5148), and a nice cached 1.js page that respects the format.