Permalink
Browse files

Merge pull request #25 from noctivityinc/master

Fixed is_tablet_device? to work with Ruby 1.9.3
  • Loading branch information...
2 parents d442479 + d159182 commit 1115f77ea9fe32dca1dc64a27fcfda1d1ab203a2 @benlangfeld committed Nov 15, 2012
Showing with 6 additions and 6 deletions.
  1. +6 −6 lib/mobile-fu.rb
View
@@ -70,11 +70,11 @@ def has_mobile_fu(set_request_format = true)
# Add this to your controllers to prevent the mobile format from being set for specific actions
# class AwesomeController < ApplicationController
# has_no_mobile_fu_for :index
- #
+ #
# def index
# # Mobile format will not be set, even if user is on a mobile device
# end
- #
+ #
# def show
# # Mobile format will be set as normal here if user is on a mobile device
# end
@@ -139,12 +139,12 @@ def in_tablet_view?
# Returns either true or false depending on whether or not the user agent of
# the device making the request is matched to a device in our regex.
- def is_mobile_device?
- !is_tablet_device? && !!mobile_device
+ def is_tablet_device?
+ !!(request.user_agent.to_s.downcase =~ Regexp.new(ActionController::MobileFu::TABLET_USER_AGENTS))
end
- def is_tablet_device?
- request.user_agent.to_s.downcase =~ Regexp.new(ActionController::MobileFu::TABLET_USER_AGENTS)
+ def is_mobile_device?
+ !is_tablet_device? && !!mobile_device
end
def mobile_device

0 comments on commit 1115f77

Please sign in to comment.