I\'m using this code (taken from here) in ApplicationController to detect iPhone, iPod Touch and iPad requests:
before_filter :detect_mobile_request, :detec
I solved this problem by using this before_filter in my ApplicationController:
def set_mobile_format
request.formats.unshift(Mime::MOBILE) if mobile_client?
end
This puts the mobile format to the front of the list of acceptable formats. So, the Resolver prefers .mobile.erb
templates, but will fall back to .html.erb
if no mobile version is found.
Of course, for this to work you need to implement some kind of #mobile_client?
function and put Mime::Type.register_alias "text/html", :mobile
into your config/initializers/mime_types.rb