I\'m looking to do some mobile-specific layouts in my app, and have been researching ways to detect mobile browsers and serve mobile specific layouts.
I came across
There is actually a much simpler regular expression you can use. The approach is outlined in this Railscast and allows you to load different JS and define different page interactions for mobile devices.
Essentially you end up with a function that simply checks that the user-agent contains 'Mobile' or 'webOS':
def mobile_device?
if session[:mobile_param]
session[:mobile_param] == "1"
else
request.user_agent =~ /Mobile|webOS/
end
end