In my ApplicatoinController I have:
class ApplicationController < ActionController::Base
MOBILE_USER_AGENTS = 'palm|palmos|palmsource|iphone|blackberry|
nokia|phone|midp|mobi|pda|' +
'wap|java|nokia|hand|symbian|chtml|wml|
ericsson|lg|audiovox|motorola|' +
'samsung|sanyo|sharp|telit|tsm|mobile|mini|
windows ce|smartphone|' +
'240x320|320x320|mobileexplorer|j2me|sgh|
portable|sprint|vodafone|' +
'docomo|kddi|softbank|pdxgw|j-phone|astel|
minimo|plucker|netfront|' +
'xiino|mot-v|mot-e|portalmmm|sagem|sie-s|
sie-m|android|ipod'
def is_mobile_device?
request.user_agent.to_s.downcase =~ Regexp.new
(MOBILE_USER_AGENTS)
end
My problem is in my /views/layouts/application.html.erb I have:
<% if is_mobile_device? %>
I get:
undefined method `is_mobile_device?' for #<ActionView::Base:0x6752ff0>
How can I refer to is_mobile_device? from this view -- as well as all
views and controllers -- I want to be DRY about this - how can I do
that? -Janna B.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---