Skip to content

Instantly share code, notes, and snippets.

@dougireton
Created July 21, 2010 15:36
Show Gist options
  • Save dougireton/484644 to your computer and use it in GitHub Desktop.
Save dougireton/484644 to your computer and use it in GitHub Desktop.
class ApplicationController < ActionController::Base
protect_from_forgery
require 'rack/mobile-detect'
use Rack::MobileDetect
# set the Rails request.format (MIME type) to :iphone for iPhone/iPod Touch
# This allows us to serve separate layouts/views for iPhone/iPod
case request.headers['X_MOBILE_DEVICE']
when /iPhone|iPod/ then request.format = :iphone
else
end
end
# this throws this error when I run Rails Server:
# Routing Error
# undefined local variable or method `request' for ApplicationController:Class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment