Subdomains

I’ve got a working app at mysite.com and trying to add
iphone.mysite.com - problem is that I get the classic “Application
error - Rails application failed to start properly” and I don’t see
anything new in while tailing my log/development.log file. Any ideas
where else I can look or what could be wrong?

Here is what is in my controllers/application.rb…

before_filter :detect_request

def detect_request
request.format = :iphone if iphone_request?
request.format = :mobi if mobile_request?
end

def iphone_request?
request.subdomains.first == “iphone”
end

def mobile_request?
request.subdomains.first == “m”
end

if the application isnt starting it probably isnt a controller, most
likely something funky in your initializer (config/envrionment.rb) or
your actual environment file (config/environments/development.rb) or
possibly in a plugin you recently added. have you changed anything in
those 3 locations recently?

The only thing I change is that before_filter :detect_request

Detecting the browser’s user agent works (see below), but detecting
subdomains does not.

def iphone_request?
# Mobile Safari
request.env[“HTTP_USER_AGENT”] && request.env[“HTTP_USER_AGENT”][/
(Mobile/.+Safari)/]
end