Skip to content

Instantly share code, notes, and snippets.

@hcatlin
Created Dec 28, 2008
Embed
What would you like to do?
# 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