《谁在线》在 Rails 中使用设计 [英] "Who's Online" using Devise in Rails

查看:26
本文介绍了《谁在线》在 Rails 中使用设计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 Devise on Rails,是否有某种方法可以列出当前具有活动会话的所有用户,即当前登录的用户?

Using Devise on Rails, is there some way to list all the users who currently have active sessions i.e. the users that are currently logged in?

附言.我正在寻找一个强大的解决方案,而不是像 this question

Ps. I'm looking for a robust solution, not something simplistic like the ones in this question

推荐答案

https://github.com/ctide/devise_lastseenable

您可以使用我编写的这个 gem 来存储用户的last_seen"时间戳.从那里,显示过去 5 或 10 分钟内最后看到的用户非常简单.

You can use this gem that I wrote to store the 'last_seen' timestamp of a user. From there, it's pretty trivial to display the users who were last_seen in the last 5 or 10 minutes.

这篇关于《谁在线》在 Rails 中使用设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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