rails 3,使用 Devise,如何添加 :lockable ? [英] rails 3, using Devise, how add :lockable after the fact?
本文介绍了rails 3,使用 Devise,如何添加 :lockable ?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我成功使用了 devise,但决定添加 :lockable 模块.我们的表称为用户.
I am using devise successfully, but decided to add the :lockable module. Our table is called Users.
在完成初始设置后,我找不到有关如何添加新设计模块(或删除一个)的文档.
I cannot find docs on how to add a new devise module (or remove one) after doing an initial setup.
推荐答案
您应该能够在迁移中执行以下操作
You should be able to do the following in a migration
change_table(:users) do |t|
t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
end
它添加的字段是:
t.integer "failed_attempts", :default => 0
t.string "unlock_token"
t.datetime "locked_at"
这篇关于rails 3,使用 Devise,如何添加 :lockable ?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文