gpt4 book ai didi

ruby-on-rails - 名称错误 : uninitialized constant DeviseMultipleTokenAuthDevice

转载 作者:数据小太阳 更新时间:2023-10-29 07:58:38 26 4
gpt4 key购买 nike

你好程序员和开发人员!!!,当我尝试访问 DeviseMultipleTokenAuthDevice 时,我在 rails console 中遇到了问题然后我收到以下错误:< br/>

Loading development environment (Rails 4.2.0)
2.2.4 :001 > DeviseMultipleTokenAuthDevice
NameError: uninitialized constant DeviseMultipleTokenAuthDevice
from (irb):1
from /Users/vishal/.rvm/gems/ruby-2.2.4@devise_demo/gems/railties-4.2.0/lib/rails/commands/console.rb:110:in `start'
from /Users/vishal/.rvm/gems/ruby-2.2.4@devise_demo/gems/railties-4.2.0/lib/rails/commands/console.rb:9:in `start'
from /Users/vishal/.rvm/gems/ruby-2.2.4@devise_demo/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:68:in `console'
from /Users/vishal/.rvm/gems/ruby-2.2.4@devise_demo/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/vishal/.rvm/gems/ruby-2.2.4@devise_demo/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
2.2.4 :002 >



下面是我在我的项目中用于用户身份验证的 gem

gem 'devise'
gem 'devise_multiple_token_auth'


以下是我记录的表格:

2.2.4 :002 > p ActiveRecord::Base.connection.tables
["schema_migrations", "users", "devise_multiple_token_auth_devices"]
=> ["schema_migrations", "users", "devise_multiple_token_auth_devices"]
2.2.4 :003 >


有关更多信息,您可以访问以下链接:


其他需要的信息
ruby 版本 2.2.4
Rails 版本 4.2.0
数据库 PSQL

最佳答案

同样的解决方案是,我们必须在 app/models/中创建一个名为 devise_multiple_token_auth_device.rb 的文件


这是devise_multiple_token_auth_device.rb文件的代码

class DeviseMultipleTokenAuthDevice < ActiveRecord::Base
belongs_to :user
end

关于ruby-on-rails - 名称错误 : uninitialized constant DeviseMultipleTokenAuthDevice,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44238355/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com