added a condition for route path

This commit is contained in:
Saurabh Bhatia 2014-04-09 12:57:34 +08:00
parent 42a17f6c19
commit 5f9d653598
1 changed files with 7 additions and 1 deletions

View File

@ -473,13 +473,17 @@ class ApplicationController < ActionController::Base
if (@site.mobile_on.eql?(true) && @site.mobile_api_openness_on.eql?(true)) if (@site.mobile_on.eql?(true) && @site.mobile_api_openness_on.eql?(true))
session[:mobile_param] = if request.path.eql?(@mobile_path) session[:mobile_param] = if request.path.eql?(@mobile_path)
'1' '1'
elsif request.path.eql?(root_path)
redirect_to mobile_path
elsif params[:mobile] elsif params[:mobile]
params[:mobile] params[:mobile]
else else
session[:mobile_param] session[:mobile_param]
end end
request.format = :mobile if mobile_device? request.format = :mobile if mobile_device?
elsif (@site.mobile_on.eql?(false) && @site.mobile_api_openness_on.eql?(true)) elsif (@site.mobile_on.eql?(false) && @site.mobile_api_openness_on.eql?(true))
session[:mobile_param] = if (request.path.eql?(@mobile_app_path)) 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)) session[:mobile_param] = if (request.path.eql?(@mobile_path))
'1' '1'
elsif request.path.eql?(root_path)
redirect_to mobile_path
elsif request.path.eql?(@mobile_app_path) elsif request.path.eql?(@mobile_app_path)
redirect_to root_path(mobile: 0) redirect_to root_path(mobile: 0)
elsif params[:mobile] elsif params[:mobile]