简体   繁体   中英

Rails Devise how to set confirmation_url if using Tenants

I have a Rails app using Devise and it also uses acts_as_tenant.

In my applications controller I create a variable for the url (including the tenant prefix). It's called $request_url

The issue is that the URL in the confirmation email doesn't change the Tenant prefix. For instance some .website.com vs other .website.com

How do I change this line to use that correct URL? :

<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p>

Do I need to create a new route?

Thanks for the help!

Are you saying, though, that you'd like to change where they land after confirmation? I would think you still want them to go through the confirmation controller so their account becomes enabled. If you are saying that you'd like to change where they land after being confirmed, see this answer .

As an aside

$request_url would be a global variable - those are often dangerous unless you fully understand the implications. Are you setting it in a before_filter ? You could just use and instance variable like so: @request_url = "some string"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM