Module: ApplicationHelper

Defined in:
app/helpers/application_helper.rb

Constant Summary collapse

MOBILE_USER_AGENTS =

List of mobile agents, from mobile_fu (github.com/brendanlim/mobile-fu)

'palm|blackberry|nokia|phone|midp|mobi|symbian|chtml|ericsson|minimo|' +
'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|' +
'mobile|maemo|fennec'

Instance Method Summary collapse

Instance Method Details

#is_mobile_request?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'app/helpers/application_helper.rb', line 11

def is_mobile_request?
 request.user_agent.to_s.downcase =~ /#{MOBILE_USER_AGENTS}/
end