5

Sorry for stupid question, but what exactly are scopes in devise? Problem I run into is that I want to add sign_out method to my controller, and I can't do it because config.sign_out_all_scopes is set to true by default, so changing it to false would help, but I don't understand what this config actually does. It looks like being true it will sign out all :admins or all :users by signing out one, but it doesn't make sense to me. Is "scope" actually a user? What exactly will change if I toggle this option? Thanks a lot in advance.

4

1 回答 1

4

Devise 允许您将您的用户分成不同的“范围”,例如“管理员”和“成员”,这样做的效果是您可以为每个范围获得一组路由、控制器和视图。

一个用户可以属于多个范围并随时登录到其中的任何/全部 - 因此,当该选项sign_out_all_scopes为真时,作为任何范围退出将退出当前登录范围的所有用户。

关于您的具体问题-您为什么要定义自己的注销方法?Devise 为您提供了一个。如果要修改注销方法,请确保遵循正确扩展设计控制器的说明

于 2013-07-30T09:07:55.290 回答