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

Already on GitHub? Sign in to your account

is_mobile_device and is_tablet_device? broken in Ruby 1.9.3 #24

Closed
noctivityinc opened this Issue Nov 9, 2012 · 4 comments

Comments

Projects
None yet
2 participants

In Ruby 1.9.3 the =~ returns the position of the match, not a true or false. I believe this is breaking the is_tablet_device? and is_mobile_device? methods.

I created a local init file to override these methods with the following

module ActionController
  module MobileFu
    module InstanceMethods
      def is_tablet_device?
        !!(request.user_agent.to_s.downcase =~ Regexp.new(ActionController::MobileFu::TABLET_USER_AGENTS))
      end

       def is_mobile_device?
        !is_tablet_device? && !!mobile_device
      end
    end
  end
end

Don't ask me why I had to repeat the is_mobile_device? method in my init file, all I know is that when I did not include it it still returned TRUE for an iPad but once it was there it returned the correct values.

Anyone else seeing this?

Owner

benlangfeld commented Nov 15, 2012

Pull request?

I actually didn't have time to fork and update, plus I didn't want to maintain a separate branch, so I just wrote that one init file. Sorry.

Joshua Lippiner

.:t 704.323.5661
.:e jlippiner@noctivity.com

Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Thursday, November 15, 2012 at 1:41 PM, Ben Langfeld wrote:

Pull request?


Reply to this email directly or view it on GitHub (#24 (comment)).

Owner

benlangfeld commented Nov 15, 2012

It would take you approximately 1 minute to send a pull request in the github web GUI. Closing.

Ill give it a try.

Joshua Lippiner

.:t 704.323.5661
.:e jlippiner@noctivity.com

Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Thursday, November 15, 2012 at 2:26 PM, Ben Langfeld wrote:

It would take you approximately 1 minute to send a pull request in the github web GUI. Closing.


Reply to this email directly or view it on GitHub (#24 (comment)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment