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>
像往常一样,它说我的子域是零。我怎样才能做到这一点?
谢谢。
所有的工作都非常感谢。 –