This commit is contained in:
yanxd 2014-06-13 12:02:29 +08:00
parent ceef85719e
commit 7456e37e8a
1 changed files with 20 additions and 2 deletions

View File

@ -18,7 +18,7 @@
class WelcomeController < ApplicationController
caches_action :robots
# before_filter :fake, :only => [:index, :course]
before_filter :entry_select_course, :entry_select_contest, :entry_select_user, :only => [:index]
before_filter :entry_select, :only => [:index]
def index
@ -92,9 +92,27 @@ class WelcomeController < ApplicationController
private
def entry_select
url = request.original_url
if url.include?("course.trustie.net")
render :course
return 0
elsif url.include?("contest.trustie.net")
contest
render :contest
return 0
elsif url.include?("user.trustie.net")
redirect_to(:controller => "users", :action => "index")
end
end
# 判断网站的入口,是课程 course 则跳过index去渲染 course 方法
def entry_select_course
(course() and render :course and return 0) if request.original_url.match(/course\.trustie\.net/)
if request.original_url.match(/course\.trustie\.net/)
(course() and render :course and return 0)
end
end
def entry_select_contest