From 5f9d6535983cf82017b46d146105728d8719a449 Mon Sep 17 00:00:00 2001 From: Saurabh Bhatia Date: Wed, 9 Apr 2014 12:57:34 +0800 Subject: [PATCH] added a condition for route path --- app/controllers/application_controller.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e53197b..5230135 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -473,13 +473,17 @@ class ApplicationController < ActionController::Base if (@site.mobile_on.eql?(true) && @site.mobile_api_openness_on.eql?(true)) session[:mobile_param] = if request.path.eql?(@mobile_path) - '1' + '1' + elsif request.path.eql?(root_path) + redirect_to mobile_path elsif params[:mobile] params[:mobile] else session[:mobile_param] end + request.format = :mobile if mobile_device? + elsif (@site.mobile_on.eql?(false) && @site.mobile_api_openness_on.eql?(true)) session[:mobile_param] = if (request.path.eql?(@mobile_app_path)) @@ -497,6 +501,8 @@ class ApplicationController < ActionController::Base session[:mobile_param] = if (request.path.eql?(@mobile_path)) '1' + elsif request.path.eql?(root_path) + redirect_to mobile_path elsif request.path.eql?(@mobile_app_path) redirect_to root_path(mobile: 0) elsif params[:mobile]