2012-05-07 69 views
1

我想配置设计邮件发送有效的子域(默认情况下所有链接指向主域)。发送电子邮件从子域上设计不工作

我跟随这名: 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) 

的运转轨道3.2.3,设计1.8.6

+0

你是怎么调用'subdomain'?该错误表明你将它作为一个'User'对象的实例方法调用,这将是不正确的。 – x1a4

+0

请检查更新后的问题。 – Martin

回答

1

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

config.action_mailer.default_url_options = { :host => "subdomain.domain.com" }