【发布时间】:2020-04-06 22:20:29
【问题描述】:
我正在使用 devise_token_auth 来验证 rails-api 应用程序。我已将这些设计模块包含在我的用户模型中,如下所示。
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :confirmable
end
问题是当我在电子邮件注册端点上执行POST 请求时,http://localhost:3000/auth 使用email、password 和password_confirmation 作为参数。它只在服务器重新启动后成功一次。注册用户的所有后续请求都失败并出现此错误:
{
"status": 500,
"error": "Internal Server Error",
"exception": "#<ArgumentError: After create callback :send_on_create_confirmation_instructions has not been defined>",
"traces": {
...
}
这意味着每次我想注册用户时都必须重新启动服务器。
这就是我在Gemfile 中的内容。
gem 'devise', github: "plataformatec/devise"
gem 'devise_token_auth', github: "lynndylanhurley/devise_token_auth"
编辑
当我对ApplicationController 进行任何更改并保存时。请求成功,无需重启服务器。
【问题讨论】:
标签: ruby-on-rails devise