将额外数据添加到 Clearance cookie 中?

Adding extra data into Clearance cookie?

我在 Rails 5 应用程序中使用 Clearance 进行身份验证,我想知道存储重要(对应用程序)用户数据的最佳方式是什么?现在我通过覆盖 Clearance::SessionsController 将它存储在会话中,但我担心用户返回应用程序并且会话是从 remember_token.

构建的

我是否应该将其添加到 cookie 中以便跨会话持久保存?或者有没有办法将其存储在 Clearance 的 cookie 中?更好的是,有没有办法让 Clearance 在从 remember_token?

构建会话时将必要的数据添加到会话中

所以在查看 Clearance::SessionsController 之后,我注意到 redirect_signed_in_users 方法被用作 before_action/before_filter。我最终覆盖了该方法以添加我需要的 ID,类似于 #create 方法。我为没有早点注意到这一点而感到有些尴尬,因为这正是我所需要的。