Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should session[:mobile_view] be checked in is_mobile_device? #27

Open
lyslim opened this issue Dec 29, 2011 · 3 comments
Open

Should session[:mobile_view] be checked in is_mobile_device? #27

lyslim opened this issue Dec 29, 2011 · 3 comments

Comments

@lyslim
Copy link

lyslim commented Dec 29, 2011

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.

@benlangfeld
Copy link

It seems you have prepared this patch against this repository, which is significantly out of date. You should check out my fork for the version published as a gem. The existing method is this:

 def is_mobile_device?
   !!mobile_device
 end

 def mobile_device
   request.headers['X_MOBILE_DEVICE']
 end

You might try:

def is_mobile_device?
  !!mobile_device || session[:mobile_view].present?
end

@lyslim
Copy link
Author

lyslim commented Dec 30, 2011

Hmmm, then I would continue on the plugin as I don't foresee a big advantage on the gem?

@benlangfeld
Copy link

This project is abandoned. Please see the active fork at http://github.com/benlangfeld/mobile-fu. Please test with the released gem and master branch of the new home for the project, and file an issue on the other repo if you still have problems.

See #40.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants