From 7456e37e8a11690e89ff4e5208b611e790f434cf Mon Sep 17 00:00:00 2001 From: yanxd Date: Fri, 13 Jun 2014 12:02:29 +0800 Subject: [PATCH] home --- app/controllers/welcome_controller.rb | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index c92f39d34..c20dfa36d 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -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