Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/59.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails ArgumentError:创建回调后:未定义发送\u on\u创建\u确认\u指令。设计令牌认证_Ruby On Rails_Devise - Fatal编程技术网

Ruby on rails ArgumentError:创建回调后:未定义发送\u on\u创建\u确认\u指令。设计令牌认证

Ruby on rails ArgumentError:创建回调后:未定义发送\u on\u创建\u确认\u指令。设计令牌认证,ruby-on-rails,devise,Ruby On Rails,Devise,我使用它来验证rails api应用程序。我已将这些Desive模块包括在我的用户模型中,如下所示 class User < ActiveRecord::Base devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :confirmable end 这意味着每次我想注册用户时都必须重新启动服务器 这是我在gem文件中的内容 gem 'dev

我使用它来验证rails api应用程序。我已将这些Desive模块包括在我的用户模型中,如下所示

class User < ActiveRecord::Base
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :confirmable
end
这意味着每次我想注册用户时都必须重新启动服务器

这是我在
gem文件中的内容

gem 'devise', github: "plataformatec/devise"
gem 'devise_token_auth', github: "lynndylanhurley/devise_token_auth"
编辑


当我在
ApplicationController
中进行任何更改并保存它时。请求在不重新启动服务器的情况下成功。

我终于找到了解决方案,问题在于
设计令牌身份验证中
注册控制器
创建
方法中的这一行:

# override email confirmation, must be sent manually from ctrl
    resource_class.skip_callback("create", :after, :send_on_create_confirmation_instructions) 
我不知道为什么我想跳过发送确认指令,而我想要的行为是在创建用户时自动发送确认


因此,我使用
design\u token\u auth
gem文档中提供的有关控制器的信息,创建了一个覆盖
RegistrationController
create
方法。在覆盖中,我注释掉了该行,所有内容都按预期工作。

添加该行后: 资源\u类。跳过\u回调(“创建”,:之后,:发送\u关于\u创建\u确认\u指令)

完成任务就行了

并添加此行以再次设置回调。 资源\类。设置\回调(“创建”,:之后,:发送\创建\确认\指令)

跳过回调后,我们需要再次设置回调

# override email confirmation, must be sent manually from ctrl
    resource_class.skip_callback("create", :after, :send_on_create_confirmation_instructions)