rails/rails — Issue #5086: Format choosing of partials has changed between Rails 2.3 and Rails 3.2
Author: timhaines
Created: 2012-02-19 04:19:08+00:00
State: open

Not sure if this is a bug, but it feels like it is.

Setup:

* Register the :mobile mime type as an alias to 'text/html'
* Set request.format to be :mobile
* The main action template is named action.erb
* There are partials _partial.html.erb and _partial.mobile.erb

In Rails 2.3 the mobile partial would have been shown, obeying the request.format.

In Rails 3.2 the .html.erb partial is shown, because the default_format of the initial template is used.

You can get Rails 3.2 to show the mobile template by adding this to the action:

```ruby
respond_to { |format| format.any }
```
This is because the respond_to causes the format to be frozen to :mobile as per the request.format.