轨道3,使用Devise,如何添加:可锁定后的事实? [英] rails 3, using Devise, how add :lockable after the fact?

查看:137
本文介绍了轨道3,使用Devise,如何添加:可锁定后的事实?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用devise成功,但决定添加:可锁定模块。我们的表被称为用户。

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"

这篇关于轨道3,使用Devise,如何添加:可锁定后的事实?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆