1
나는 Devise를 인증 용으로 사용하여 다중성 애플리케이션을 개발 중입니다. 이 빌드에서는 하위 도메인을 사용하는 것이 중요합니다. 로그인 후 하위 도메인으로 리디렉션
현재 내 셋업은 로그인 할 수 있도록 자신의 하위 도메인을 '기억'에 사용자를 강제로 포함되어 있습니다. 내가 달성하고자하는 어떤경로
constraints(SubdomainPresent) do
root 'users#index', as: :subdomain_root
resources :users
resources :accounts
end
devise_for :users
이다 매우 비슷한 내 사용자가 처음 저장 될 때 어떤 일이 일어나면 로그인 할 때 하위 도메인으로 리디렉션됩니다 (URL 구조에 반영 됨). subdomain.example.com
계정 컨트롤러
if @account.valid?
Apartment::Tenant.create(@account.subdomain)
Apartment::Tenant.switch(@account.subdomain)
@account.save
format.html { redirect_to new_user_session_url(subdomain: @account.subdomain), notice: 'Account was successfully created.' }
내가 그렇게 내 사용자가 사이트가 아닌 하위 도메인 위치에있는 모든 곳에서 로그인 할 수 있습니다 그것을 가지고, 그리고 그들의 올바른 dashbaord로 리디렉션, 그리고 하위 도메인의 URL 구조
것