0
由於我的應用程序與子域一起工作,我需要獲取用戶在註冊過程中的子域。這可以通過request.subdomain
或我的自定義方法current_subdomain
進行,並適用於所有應用程序。Rails 3 - 生成確認電子郵件時更改設計主機
但它永遠不會去設計。我的最後一次嘗試是重寫RegistrationsController
,但沒有成功。
class RegistrationsController < Devise::RegistrationsController
def new
@subdomain = current_subdomain
puts @subdomain + " ON NEW"
resource = build_resource({})
respond_with_navigational(resource, @subdomain){ render_with_scope :new }
#super
end
def create
@subdomain = current_subdomain
puts @subdomain + " ON CREATE"
super
end
end
不是說puts
在這個過程中完美地工作。
是在電子郵件中生成的鏈接上的默認設計視圖,和我配置一樣的是:
<p><%= link_to 'Confirm!', confirmation_url(@resource, :confirmation_token =>
@resource.confirmation_token, :host => @subdomain+".lvh.me:3000") %></p>
像往常一樣,它說我的子域是零。我怎樣才能做到這一點?
謝謝。
所有的工作都非常感謝。 –