Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/58.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 在Ruby on Rails中使用Desive gem中的可锁定模块时,为什么我的失败尝试字段没有增加?_Ruby On Rails_Devise - Fatal编程技术网

Ruby on rails 在Ruby on Rails中使用Desive gem中的可锁定模块时,为什么我的失败尝试字段没有增加?

Ruby on rails 在Ruby on Rails中使用Desive gem中的可锁定模块时,为什么我的失败尝试字段没有增加?,ruby-on-rails,devise,Ruby On Rails,Devise,在设备中使用可锁定模块时,为什么失败\u尝试字段没有增加?我的设置有问题吗失败\u尝试不会从0移动 routes.rb devise_for :users, controllers: { registrations: 'users/registrations' } devise_for :admins, controllers: { registrations: 'admins/registrations' }, skip: [:sessions] create_table "admins",

在设备中使用可锁定模块时,为什么
失败\u尝试
字段没有增加?我的设置有问题吗<当登录失败且密码错误时,代码>失败\u尝试不会从0移动

routes.rb

devise_for :users, controllers: { registrations: 'users/registrations' }
devise_for :admins, controllers: { registrations: 'admins/registrations' }, skip: [:sessions]
create_table "admins", :force => true do |t|
    ...
    t.integer  "failed_attempts",                       :default => 0
    t.string   "unlock_token"
    t.datetime "locked_at"
    ...
end

create_table "users", :force => true do |t|
    ...
    t.integer  "failed_attempts",                                  :default => 0
    t.string   "unlock_token"
    t.datetime "locked_at"
    ...
end
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :token_authenticatable, :lockable, remember_for: 4.weeks
devise :database_authenticatable, :registerable, :recoverable, :trackable, :validatable, :lockable, :timeoutable, timeout_in: 60.minutes
config.lock_strategy = :failed_attempts
config.unlock_keys = [ :email ]
config.unlock_strategy = :both
config.maximum_attempts = 3
config.unlock_in = 1.hour
schema.rb

devise_for :users, controllers: { registrations: 'users/registrations' }
devise_for :admins, controllers: { registrations: 'admins/registrations' }, skip: [:sessions]
create_table "admins", :force => true do |t|
    ...
    t.integer  "failed_attempts",                       :default => 0
    t.string   "unlock_token"
    t.datetime "locked_at"
    ...
end

create_table "users", :force => true do |t|
    ...
    t.integer  "failed_attempts",                                  :default => 0
    t.string   "unlock_token"
    t.datetime "locked_at"
    ...
end
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :token_authenticatable, :lockable, remember_for: 4.weeks
devise :database_authenticatable, :registerable, :recoverable, :trackable, :validatable, :lockable, :timeoutable, timeout_in: 60.minutes
config.lock_strategy = :failed_attempts
config.unlock_keys = [ :email ]
config.unlock_strategy = :both
config.maximum_attempts = 3
config.unlock_in = 1.hour
user.rb

devise_for :users, controllers: { registrations: 'users/registrations' }
devise_for :admins, controllers: { registrations: 'admins/registrations' }, skip: [:sessions]
create_table "admins", :force => true do |t|
    ...
    t.integer  "failed_attempts",                       :default => 0
    t.string   "unlock_token"
    t.datetime "locked_at"
    ...
end

create_table "users", :force => true do |t|
    ...
    t.integer  "failed_attempts",                                  :default => 0
    t.string   "unlock_token"
    t.datetime "locked_at"
    ...
end
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :token_authenticatable, :lockable, remember_for: 4.weeks
devise :database_authenticatable, :registerable, :recoverable, :trackable, :validatable, :lockable, :timeoutable, timeout_in: 60.minutes
config.lock_strategy = :failed_attempts
config.unlock_keys = [ :email ]
config.unlock_strategy = :both
config.maximum_attempts = 3
config.unlock_in = 1.hour
admin.rb

devise_for :users, controllers: { registrations: 'users/registrations' }
devise_for :admins, controllers: { registrations: 'admins/registrations' }, skip: [:sessions]
create_table "admins", :force => true do |t|
    ...
    t.integer  "failed_attempts",                       :default => 0
    t.string   "unlock_token"
    t.datetime "locked_at"
    ...
end

create_table "users", :force => true do |t|
    ...
    t.integer  "failed_attempts",                                  :default => 0
    t.string   "unlock_token"
    t.datetime "locked_at"
    ...
end
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :token_authenticatable, :lockable, remember_for: 4.weeks
devise :database_authenticatable, :registerable, :recoverable, :trackable, :validatable, :lockable, :timeoutable, timeout_in: 60.minutes
config.lock_strategy = :failed_attempts
config.unlock_keys = [ :email ]
config.unlock_strategy = :both
config.maximum_attempts = 3
config.unlock_in = 1.hour
设计.rb

devise_for :users, controllers: { registrations: 'users/registrations' }
devise_for :admins, controllers: { registrations: 'admins/registrations' }, skip: [:sessions]
create_table "admins", :force => true do |t|
    ...
    t.integer  "failed_attempts",                       :default => 0
    t.string   "unlock_token"
    t.datetime "locked_at"
    ...
end

create_table "users", :force => true do |t|
    ...
    t.integer  "failed_attempts",                                  :default => 0
    t.string   "unlock_token"
    t.datetime "locked_at"
    ...
end
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :token_authenticatable, :lockable, remember_for: 4.weeks
devise :database_authenticatable, :registerable, :recoverable, :trackable, :validatable, :lockable, :timeoutable, timeout_in: 60.minutes
config.lock_strategy = :failed_attempts
config.unlock_keys = [ :email ]
config.unlock_strategy = :both
config.maximum_attempts = 3
config.unlock_in = 1.hour
版本

Rails 3.2.0
Ruby 1.9.3p194
Devise 2.1.2

配置看起来不错。当尝试失败时,是否可以添加日志详细信息?具体来说,日志应该显示一个sql查询,以更新该用户的
失败的\u尝试
字段。或者给出一些指示,说明它为什么不这样做。我也有类似的问题。你能告诉我你为此做了什么吗?