Specifying a :format in link_to doesn't work in rails 3.2.2

cbron picture cbron · May 2, 2012 · Viewed 10.6k times · Source

I'm moving a project from rails 3.1 to rails 3.2.2 and I have this:

= link_to 'CSV', :action => 'list', :search => @search, :format => 'csv'

In rails 3.1 this specifies the format in the html link (format=csv) and it is caught by a respond_with, but in 3.2.2 the format never makes it into the link. I scanned through the list of commits on github and can't find anything that relates to this.

Edit:

Looks like this is an issue with url_for

#rails 3.1
url_for :controller=>'posts', :action=>'index', :format=>:xml
/admin/posts/index?format=xml

#rails 3.2.2
url_for :controller=>'posts', :action=>'index', :format=>:xml
/admin/posts/index

#rails 3.2.2
url_for :controller=>'posts', :action=>'index', :format=>:xml, :id => 5
/admin/posts/index/5.xml