Skip to content

Instantly share code, notes, and snippets.

@HamptonMakes
Created December 28, 2008 22:59
Show Gist options
  • Save HamptonMakes/41074 to your computer and use it in GitHub Desktop.
Save HamptonMakes/41074 to your computer and use it in GitHub Desktop.
# Controller
def set_content_type
content_type = guess_content_type
Merb.logger.debug "Setting content type as " + content_type.to_s
end
def guess_content_type
ua = request.user_agent
if ua.include? "WebKit"
if ua.include? "iPhone"
if ua.include? "Safari"
:iphone_safari
else
:iphone_native
end
else
:webkit
end
else
:wap
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment