2016-06-11 2 views

답변

0

scope 블록에 모든 경로를 넣어 :

$ rake routes 
Prefix Verb URI Pattern  Controller#Action 
root GET /srv3(.:format) root#index 
... 

:

Rails.application.routes.draw do 
    scope "/srv3" do  
    root to: "root#index" 
    ... 
    end 
end 

그런 다음 모든 경로는 /srv3 접두사가됩니다참조 자세한 내용은을 참조하십시오.

+0

은작동하지 아무튼 인증을 확인하려는 경우 당신은 이런 식으로 뭔가를 할 수 있습니다 routes.rb의내게 : 루트 : to => 'pages # home' "Welcom 타고있다"페이지가 보입니다! –

+0

페이지를 볼 때 URL에''/ srv3''이 있습니까? 나는. 예를 들어 보시겠습니까? 'http :/localhost : 3000/srv3 /'? – BoraMa

+0

예, [http://portail.lyc-st-exupery-bellegarde.ac-lyon.fr/srv3] –

0

나는 많이 당신이 말하는 셈,하지만 내가 이해할 수있는 것은 당신이 당신의 application_controller.rb

에 그럼 다음처럼 작성할 경우 root_path이 http://portail.lyc-st-exupery-bellegarde.ac-lyon.fr/srv3 대신 http://portail.lyc-st-exupery-bellegarde.ac-lyon.fr

될 것인지 무엇을 얻을하지 않습니다

before_filter :check_url 

def check_url 
    if request.path_info == '/' 
    redirect_to 'http://portail.lyc-st-exupery-bellegarde.ac-lyon.fr/srv3' 
    end 
end 

또는 너무

def check_url 
    if request.path_info == '/' and current_user.present? 
    redirect_to 'http://portail.lyc-st-exupery-bellegarde.ac-lyon.fr/srv3' 
    end 
end