이 URL은 orgname.lvh.me:3000
과 같으며 잘 작동합니다. 이제 특정 작업 후에이 URL로 리디렉션해야합니다. 나는이lvh를 사용하여 하위 도메인으로 리디렉션하는 방법
을해야합니까 어떻게이
root_path(subdomain: "orgname")
시도하지만 이것은 단순히 로컬 호스트 것입니다 : 3000. 하지만 그 대신 내가 좋아하는 URL로 리디렉션 할
orgname.lvh.me:3000
이 URL은 orgname.lvh.me:3000
과 같으며 잘 작동합니다. 이제 특정 작업 후에이 URL로 리디렉션해야합니다. 나는이lvh를 사용하여 하위 도메인으로 리디렉션하는 방법
을해야합니까 어떻게이
root_path(subdomain: "orgname")
시도하지만 이것은 단순히 로컬 호스트 것입니다 : 3000. 하지만 그 대신 내가 좋아하는 URL로 리디렉션 할
orgname.lvh.me:3000
처럼 결국이 문자열 보간
def after_confirmation_path_for(resource_name, resource)
byebug
"#{resource.name}.lvh.me:3000"
#TODO redirect to a subdomain resource.name is giving the organization name
end
을 시도
URL을 리디렉션으로 전달하십시오.
redirect_to 'http://orgname.lvh.me:3000'
나는 동일한 문제가 있었지만, 여러 가지 방법을 시도했지만 정말 간단합니다. root_path를 사용하는 대신 root_url을 사용하여 devise 메소드 after_sign_in_path_for를 재정의하십시오.
#application_controller.rb
def after_sign_in_path_for(resource)
root_url(subdomain: "orgname")
end
나는 그것이 당신을 도왔기를 바랍니다.