2

我正在尝试将发送的设计电子邮件配置为对子域有效(默认情况下,所有链接都指向主域)。

我正在关注这个: https ://github.com/plataformatec/devise/wiki/How-To%3A-Send-emails-from-subdomains

问题是我收到了这个错误

NoMethodError in Devise/passwords#create

Showing     /Users/user/Sites/site/app/views/devise/mailer/reset_password_instructions.html.haml where line #6 raised:

undefined method `subdomain' for #<User:0x007fb0019be868>

subdomain从视图中调用:

# app/views/devise/mailer/confirmation_instructions.html
%strong= link_to t('devise.confirmation_instructions.confirm_my_account'), confirmation_url(@resource, :confirmation_token => @resource.confirmation_token, :subdomain => @resource.subdomain)

运行 Rails 3.2.3,设计 1.8.6

4

1 回答 1

1

通过在环境配置中添加子域来解决。

config.action_mailer.default_url_options = { :host => "subdomain.domain.com" }  
于 2012-05-08T00:06:34.650 回答