【发布时间】:2019-02-06 18:14:26
【问题描述】:
我目前正在测试一个多租户应用程序。当用户注册帐户时,会为该帐户创建一个子域。成功创建后,会发生以下过程:
帐户管理员
def create
@account = Account.new(account_params)
if @account.save
sign_in(@account.owner)
flash[:notice] = "Your account has been created."
redirect_to root_url(subdomain: @account.subdomain)
else
flash.now[:alert] = "Sorry, your account could not be created."
render :new
end
end
用户被重定向到他们的帐户,网址现在是 subdomain.url.com
上述方法在开发中与 lvh.me 配合使用非常好,但是当我使用 ngrok 进行测试时 - 用于测试条带式网络书 - 我的 ngrok 隧道地址与正在设置的子域冲突。
我的条纹电子书看起来像这样: https://3abg89zc.ngrok.io/webhooks/stripe
创建帐户后,我的网址转到:https://subdomain.ngrok.io/
【问题讨论】:
标签: ruby-on-rails devise stripe-payments multi-tenant