module ActionDispatch::Http::MimeNegotiation

def formats=(extensions)

end
end
request.formats = [ :iphone, :html ] if request.env["HTTP_USER_AGENT"][/iPhone/]
def adjust_format_for_iphone_with_html_fallback
private

before_action :adjust_format_for_iphone_with_html_fallback
class ApplicationController < ActionController::Base

otherwise it'll fall back to the `:html` format.
In this example, the `:iphone` format will be used if it's available,

fallback.
you to set multiple, ordered formats, which is useful when you want to have a
Sets the formats by string extensions. This differs from #format= by allowing
def formats=(extensions)
  parameters[:format] = extensions.first.to_s
  set_header "action_dispatch.request.formats", extensions.collect { |extension|
    Mime::Type.lookup_by_extension(extension)
  }
end