我在成功注册到他们各自的子域后尝试重定向用户。我在 application_controller 中输入了以下代码。
application_controller.rb
protected
def after_sign_in_path_for(resource)
redirect_to root_url(subdomain: @users.subdomain)
end
我收到以下错误
NoMethodError in Devise::SessionsController#create
undefined method `subdomain' for nil:NilClass
Extracted source (around line #10):
def after_sign_up_path_for(subdomain)
redirect_to root_url(subdomain: @users.subdomain)
end