I have a minor issue getting my user agent detection to work. Whenever i try it on production it does not work.. i have this in my application controller
before_filter :prepare_for_mobile
private
def mobile_device?
if session[:mobile_param]
session[:mobile_param] == "1"
else
request.user_agent =~ /Mobile|webOS/
end
end
helper_method :mobile_device?
def prepare_for_mobile
session[:mobile_param] = params[:mobile] if params[:mobile]
request.format = :mobile if mobile_device?
end
but it does not work when i am on production mode.. so also i would like to know how to set the user agent for blackberry andriod, iphone, nokias3, bada and windows os. thank you
can you post a copy of your config/environments/production.rb file?
Side-Note:
You probably want to add something like this if you don’t want to break xml or json output, (with responds_to blocks):