gpt4 book ai didi

ruby-on-rails - Rails 3 + 迁移中的设计错误 : undefined method timeoutable

转载 作者:行者123 更新时间:2023-12-04 06:23:11 24 4
gpt4 key购买 nike

我在我的应用程序中使用 rails 3 和 Devise 1.3.4 进行身份验证。
生成用户模型后,我尝试将更多设计模块添加到我的 devise_create_users.rb 迁移文件中,但出现错误:
ActiveRecord::ConnectionAdapters::TableDefinition 的未定义方法“超时”。

但是,添加其他模块,如 :confirmable 就可以了。

devise_create_user.rb:

create_table(:users) do |t|
t.database_authenticatable :null => false
t.recoverable
t.rememberable
t.trackable
t.timeoutable
# t.encryptable
t.confirmable
# t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
# t.token_authenticatable


t.timestamps
end

我的用户模型:
class User < ActiveRecord::Base

# Include default devise modules. Others available are:
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable, :confirmable , :timeoutable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me
end

任何想法可能是什么错误?

最佳答案

答案是您实际上不需要任何可超时的迁移,它只是用户/资源类的声明。看
How do I add Devise's 'timeoutable' module to an existing Devise install? - Rails 3.1

关于ruby-on-rails - Rails 3 + 迁移中的设计错误 : undefined method timeoutable,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6470546/

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