In a layout, I'd like to write something like
<% if has_format?(:foo) -%>
<%= link_to 'Foo version', :format => :foo %>
<% end %>
Grabbing into protected method territory, I can even define a suitable
I'd much rather have an official method, say
ActionController::MimeResponds#responds_to?(format), and a helper method
#has_format?(format) defined in terms of it. As the name #responds_to?
is dangerously close to #respond_to?, #responds_to_format? may be safer,
if less pretty. Also, it might be a good idea for
#collect_mimes_from_class_level to memoize its result.
Is there any reason against this? A better way?