Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用 Devise 发送电子邮件(例如“重置密码说明”)时,我需要知道当前域 URL,并将该值设置到邮件模板中。
request.url 对我不起作用。
假设,这个 Rails 应用程序可以从多个 URL 访问。
有任何想法吗?
请求对象在邮件中不可用。您需要在环境配置文件中设置主机,例如:
ActionMailer::Base.default_url_options[:host] = 'myhost.com'