DetectMobiles ============= !!! Also detects iPhone and iPod Touch, now !!! This plugin provides an instance method to ActionController::Base which can be used as a before_filter. The filter scans the request for indication of a mobile browser or an iPhone/iPod and then sets request.format to either :mobile or :iphone. This can be used in the responds_to block and in the views. Usage Example ============= * install the gem * add the MIME types to config/initializers/mime_types.rb Mime::Type.register_alias "text/html", :iphone Mime::Type.register_alias "text/html", :mobile * add the gem to your config/environment.rb -> config.gem "detect_mobiles" * add the before_filter to your controller class ApplicationController < ActionController::Base before_filter :detect_mobiles end now, the request.format will be changed to :mobile/:iphone depending on the browser. Copyright (c) 2008 Alex P, released under the MIT license