2013-07-19 2 views
0

기기를 설치하고 설정할 수 있으며 등록 후 특정 페이지로 사용자를 리디렉션하는 데 문제가 있습니다. 내 루트에서 다음RoR : 기기를 등록한 후 기기를 리디렉션합니다.

class RegistrationsController < Devise::RegistrationsController 
    def after_sign_up_path_for(resource) 
    "http://google.com" 
    end 
end 

: 나는 사용자를 가입 할 때 지금, 그것은 단지 대시 보드 # 쇼로 이동됩니다

authenticated :user do 
    root :to => "dashboard#show" 
    end 

. google.com으로 이동하려고하지만이를 수행하지 않습니다. 내가 뭔가 잘못하고 있는거야? 아니면 CanCan을 사용할 때 가입 한 후 사용자를 리디렉션 할 수있는 다른 방법이 있습니까?

감사합니다.

답변

0

당신은 당신의 application_controller.rb

def after_sign_up_path_for(resource) 
    "http://google.com" 
end 

에 추가 출처 : redirec_to external_url

아니면 노선에 특정 외부 링크를 사용할 수 있습니다 당신은 (그들이 가입 한 후 사용자가 활성화되지 않음) 고안의 확인서를 사용하는 경우

# in `config/routes.rb` : 

match "/google" => redirect("http://google.com"), :as => :google 

# in `registrations_controller.rb` : 

def after_sign_up_path_for(resource) 
    google_path 
end 

처럼 보이는, 당신은 after_inactive_sign_up_path_for 방법을 사용할 수 있습니다.

# controllers/registrations_controller.rb 

class RegistrationsController < Devise::RegistrationsController 


    def after_inactive_sign_up_path_for(resource) 
    "http://google.com" 
    end 

end 
관련 문제