I have a problem with redirecting to subdomain after devise sign_in or sign_out. I generated devise controllers uncommented methods that should take me where I want but subdomains don't work.
def after_sign_in_path_for(resource)
root_url(subdomain: resource.subdomain)
end
def after_sign_out_path_for(resource_or_scope)
home_url(subdomain: "www")
end
After sign_in I receive an error
Unsafe redirect to "http://chris.lvh.me:3000/", pass allow_other_host: true to redirect anyway.
So I modified methods in couple ways but it gave me more errors, example of what I've tried:
root_url(subdomain: resource.subdomain), allow_other_hosts: true
root_url(subdomain: resource.subdomain, allow_other_hosts: true)
redirect_to root_url(subdomain: resource.subdomain),allow_other_hosts: true
redirect_to root_url(subdomain: resource.subdomain, allow_other_hosts: true)
And errors for that were: wrong amount of arguments or unexpected ', ' expected end or something.
After sign_out it takes me to sign_in page and not to home_url and subdomain doesn't change.
I'm using devise, rails-on-services/apartment and rails 7