从ActiveAdmin注销会破坏其他会话

时间:2015-11-03 14:48:53

标签: ruby-on-rails session devise activeadmin

我正在使用activeadmin和另一个模型的设计。 如果我在浏览器上打开两个界面并从一个界面注销它也会破坏其他会话。

Started GET "/admin/logout" for 127.0.0.1 at 2015-11-03 19:45:25 +0500
Processing by ActiveAdmin::Devise::SessionsController#destroy as HTML
Parameters: {"authenticity_token"=>"6rqzYcjQNgm8sOcAy2ItHvqGWTYyUBEK2tE+hJi8Ti0E25qJLR+vdA9W++HHtFaD3CpBtnNAn6xbhS6mr8YLTQ=="}
Teacher Load (30.4ms)  SELECT  `teachers`.* FROM `teachers` WHERE `teachers`.`id` = ?  ORDER BY `teachers`.`id` ASC LIMIT 1  [["id", 1]]
AdminUser Load (0.2ms)  SELECT  `admin_users`.* FROM `admin_users` WHERE `admin_users`.`id` = ?  ORDER BY `admin_users`.`id` ASC LIMIT 1  [["id", 1]]
SQL (0.1ms)  BEGIN
(0.0ms)  COMMIT
SQL (0.0ms)  BEGIN
(0.0ms)  COMMIT

1 个答案:

答案 0 :(得分:2)

默认情况下,调用Devise::SessionsController#destroy时,它将销毁所有范围内的会话。这可以通过sign_out_all_scopes进行配置。因此要禁用它,请将其设置为false:

# config/initializers/devise.rb
config.sign_out_all_scopes = false