brendanlim/mobile-fu — Issue #27: Should session[:mobile_view] be checked in is_mobile_device?
Author: lyslim
Created: 2011-12-29 17:25:53+00:00
State: open

Dear all,

I got stuck when I tried to alter session[:mobile_view] to switch between html page and mobile page, hence I changed the method is_mobile_device? a bit like below:

def is_mobile_device?
if session[:mobile_view]
session[:mobile_view] == 'true'
else
request.user_agent.to_s.downcase =~ Regexp.new(ActionController::MobileFu::MOBILE_USER_AGENTS)
end
end

Is this modification safe? Are there any better solution for this? Thanks!

@benlangfeld, seems you are active on creating the gem, could you kindly comment? Thanks.