rails/rails — pull request #13470 by strzalek (2013-12-24 16:02:29+00:00)
Title: Add any/all support for variants

Same as `format.any`, you can do the same with variants now.

It works for both inline:

```ruby
respond_to do |format|
format.html.any { render text: "any" }
format.html.phone { render text: "phone" }
end
```

and block syntax:

```ruby
respond_to do |format|
format.html do |variant|
variant.any(:tablet, :phablet){ render text: "any" }
variant.phone { render text: "phone" }
end
end
```

Regarding implementation, `VariantFilter` was removed and `VariantCollector` is used for both inline and block syntax. This is needed, as now we don't know what variant should be rendered until we collect all of them (`any` complicates this).

In the end, I think this is even better. Implementation is cleaner and more consistent because we don't have 2 different things - filter and collector - but only one, which takes care of everything.