module ActionDispatch::Http::MimeNegotiation

def format=(extension)

end
end
request.format = :iphone if request.env["HTTP_USER_AGENT"][/iPhone/]
def adjust_format_for_iphone
private

before_action :adjust_format_for_iphone
class ApplicationController < ActionController::Base

that are not controlled by the extension.
Sets the \format by string extension, which can be used to force custom formats
def format=(extension)
  parameters[:format] = extension.to_s
  set_header "action_dispatch.request.formats", [Mime::Type.lookup_by_extension(parameters[:format])]
end