【问题标题】:actionmailer question on rails 3关于rails 3的actionmailer问题
【发布时间】:2010-11-30 20:48:20
【问题描述】:

我正在尝试转换此代码

def password_reset_instructions(user)
    subject       "Registered"
    recipients    user.email
    body          :edit_password_reset_url => edit_password_reset_url(user.perishable_token)
end

到这个代码

def password_reset_instructions(user)
  @user = user
   mail(:to => user.email, :subject => "Registered")
end

我的问题是我不知道下面的代码应该放在哪里。

:edit_password_reset_url => edit_password_reset_url(user.perishable_token)"

我在 rails 3 上使用 authlogic。

【问题讨论】:

    标签: ruby-on-rails authlogic


    【解决方案1】:

    在 Rails 3 中,邮件程序就像控制器一样工作。您可以在随附的视图中使用用户的实例变量。

    【讨论】:

      【解决方案2】:

      未测试,但试试这个:

            def password_reset_instructions(user)
                @edit_password_reset_url = edit_password_reset_path(user.perishable_token)
                mail(
                   :subject    => "Password Reset Instructions",
                   :recipients => user.email
                )
            end
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-02-11
        • 1970-01-01
        • 2015-02-16
        • 2010-12-28
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多