fix mobile_fu/ipad issue

This commit is contained in:
danielvincent 2011-02-03 14:10:58 -08:00
parent d905021252
commit 7668e8d262
2 changed files with 7 additions and 5 deletions

View file

@ -395,7 +395,7 @@ ActiveRecord::Schema.define(:version => 20110202015222) do
add_index "profiles", ["first_name", "searchable"], :name => "index_profiles_on_first_name_and_searchable"
add_index "profiles", ["last_name", "searchable"], :name => "index_profiles_on_last_name_and_searchable"
add_index "profiles", ["mongo_id"], :name => "index_profiles_on_mongo_id"
add_index "profiles", ["person_id"], :name => "index_profiles_on_person_id"
add_index "profiles", ["person_id"], :name => "index_profiles_on_person_id", :unique => true
create_table "requests", :force => true do |t|
t.integer "sender_id", :null => false
@ -457,8 +457,8 @@ ActiveRecord::Schema.define(:version => 20110202015222) do
t.datetime "created_at"
t.datetime "updated_at"
t.string "mongo_id"
t.string "invitation_service", :limit => 127
t.string "invitation_identifier", :limit => 127
t.string "invitation_service"
t.string "invitation_identifier"
end
add_index "users", ["email"], :name => "index_users_on_email"

View file

@ -6,7 +6,7 @@ module ActionController
'audiovox|motorola|samsung|telit|upg1|windows ce|ucweb|astel|plucker|' +
'x320|x240|j2me|sgh|portable|sprint|docomo|kddi|softbank|android|mmp|' +
'pdxgw|netfront|xiino|vodafone|portalmmm|sagem|mot-|sie-|ipod|up\\.b|' +
'webos|amoi|novarra|cdm|alcatel|pocket|ipad|iphone|mobileexplorer|' +
'webos|amoi|novarra|cdm|alcatel|pocket|iphone|mobileexplorer|' +
'mobile'
def self.included(base)
@ -84,7 +84,9 @@ module ActionController
# the device making the request is matched to a device in our regex.
def is_mobile_device?
request.user_agent.to_s.downcase =~ Regexp.new(ActionController::MobileFu::MOBILE_USER_AGENTS)
# hack for ipad
req = request.user_agent.to_s.downcase
req =~ Regexp.new(ActionController::MobileFu::MOBILE_USER_AGENTS) && !req.match('ipad')
end
# Can check for a specific user agent