【问题标题】:Send emails from subdomains on Devise not working从 Devise 上的子域发送电子邮件不起作用
【发布时间】:2012-05-07 02:22:57
【问题描述】:

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

我正在关注这个: 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

【问题讨论】:

  • 你怎么打电话给subdomain?该错误表明您将其作为User 对象上的实例方法调用,这是不正确的。
  • 请检查更新的问题。

标签: ruby-on-rails ruby ruby-on-rails-3 devise


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 2014-07-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-08
    • 2016-02-11
    • 2012-08-01
    相关资源
    最近更新 更多