【问题标题】:Rails 3 and AuthLogic Email ActivationRails 3 和 AuthLogic 电子邮件激活
【发布时间】:2011-05-28 12:25:03
【问题描述】:

使用 Rails 3 和 Authlogic。我正在按照本教程中的步骤操作:http://bit.ly/l8YOGg

注册/登录/注销一切正常,现在我正在添加电子邮件激活。我完全按照教程中列出的方式使用了所有代码,当我尝试以新用户身份登录时,出现以下错误:

NoMethodError in UsersController#create
undefined method `activate_account_url' for #<Notifier:0x00000103c4c9b8>

app/mailers/notifier.rb:6:in `activation_instructions'
app/models/user.rb:21:in `send_activation_instructions!'
app/controllers/users_controller.rb:17:in `create'

在 Authlogic 文档或其他地方找不到任何有用的东西。我做错了什么?

【问题讨论】:

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


    【解决方案1】:

    activate_account_url 应该是一个命名路由。您是否正确定义了路线?

    【讨论】:

      【解决方案2】:

      要查找正确的路由名称,请检查rake routes,尤其是rake routes | grep activate。然后将正确的路由名称放入第 6 行的notifier.rb

      【讨论】:

        猜你喜欢
        • 2013-01-13
        • 1970-01-01
        • 2014-06-24
        • 2014-02-10
        • 2011-11-25
        • 1970-01-01
        • 1970-01-01
        • 2013-07-24
        • 2018-08-19
        相关资源
        最近更新 更多